Can't load static file

I’ve looked everywhere and followed this How to manage static files (e.g. images, JavaScript, CSS) | Django documentation | Django but I cannot get static files to load. I feel like I’m missing something really simple.


STATIC_URL = 'static/'

Folder structure

│   ├───littlelemon
│   ├───restaurant
│   │   ├───static
│   │   │   ├───restaurant
│   │   │   │   └───logo.png
│   └───templates

index.html template

{% load static %}
<img src = "{% static 'restaurant/logo.png' %}"/>

index.html rendered code (what actually shows in the HTML)

<img src = "/static/restaurant/logo.png"/>

The image does not load on the index.html page and returns a 404

What am I missing?

Thank you.

I just figured it out. I did not install the ‘restaurant’ app in the INSTALLED_APPS in the settings.

Hope this helps someone else!

1 Like