Simon Olsen
Simon Olsen

Reputation: 785

Displaying static files in Django runserver

I am having a problem where when I try to run my website through the runserver command, it doesnt display any of the images.

(I am very new to django, and website building at all)

this is the html in the template:

< img src="../../../static/Website_header.png" width="800" height="200" alt=""/> (without the whitespace)

and this is the settings.py:

http://pastebin.com/KvdrF1L2


Edit: When I tried to click display image in new tab this was shown: https://i.sstatic.net/V9JzR.jpg

Upvotes: 0

Views: 275

Answers (1)

nima
nima

Reputation: 6733

You should not have direct links to your static files.

On top of your template:

{% load staticfiles %}

Your image tag:

<img src="{% static 'images/test.png' %}" />

"images/test.png" is addressed relative to your static folder:

static
------ images
------------ test.png

Upvotes: 2

Related Questions