In Django

In this post we will not cover the details of static files. We will create a simple Dajngo project that renders an image using static files, nothing more.

We can set up our static files in 3 quick steps:

1 – Configure static files in

In newer versions STATIC_URL  is define and  django.contrib.staticfiles is included in your INSTALLED_APPS


2 – Create static folder

In the root direcory of your project create a folder call ‘static’ (Same name as you STATIC_URL in step 1).

Inside that folder create an images folder and add an image.

3 – Add image to template

To add an image to our template we need to do two things

  1. Load in our static url: {% load static %}
  2. Add image with path to url:  <img src=”{% static ‘images/construction.png’ %}”>

Now open up you page an you should have an image in your template.

Contact Us

We're not around right now. But you can send us an email and we'll get back to you, asap.