New to Django, problem with displaying images in html-frontend....

Hi folks, I#m completely new to DJANGO and new to this Forum. I tried it with search on google and in here but did not find anything that helped. I`m quite sure it is a ridiculous little thing like mising commy or something like that but while upsetting my first DJANGO Project, i have the Problem, that i only see Placeholders instead of my images i linked to the page and in console i get 404 errors onl load of them.

The files are in static/projectname/images/ Folder,

reference in html is looking like this:
<img src=“{% static “klinikXdatabase/images/title.png” %}” alt=“image”>
and YES, there is an {% load static %} right before that :wink:

‘django.contrib.staticfiles’, is in “Installed_APPS”

STATIC_URL = ‘static/’ is put in

Any Ideas or further questions to my environment?
Thx in advance :slight_smile:

The best way to start researching something like this is to examine the html in the browser to see what that img tag looks like.

Also, check your console log to see what the url was being requested for that image.

you mean this ?

Not the template, the html as it exists in the browser after being rendered and sent to the browser.

Are you running with debug = True?

What is your STATICFILES_DIRS setting?

Yea, project is set on DEBUG = True, Static environment is set by:
STATIC_URL = ‘static/’
STATIC_ROOT = ‘static/’

and generated browser html is looking like this:

But what about STATICFILES_DIRS? (STATIC_ROOT doesn’t really matter in this situation.)

i’m aware, that STATIC_ROOT is simply to enable DJANGO to collect static files in one location by python command, i just mentioned it to be complete to the static-topic. there is no STATICFILES_DIRS line so far in my project

You’ll want to add it. See the docs at How to manage static files (e.g. images, JavaScript, CSS) | Django documentation | Django

Thanks for the hint, tried it earlier that day but with simple copy and paste…this time i left the var/www/ part away and now it works :slight_smile: