I'm having some trouble displaying images in a website I'm building. I am following the instructions in the Django static files documentation. To wit, I have:
- Verified that my
settings.py
file containsSTATIC_URL = 'static/'
- Added the equivalent of the following code to my template:
{% load static %}
<img src="{% static 'my_app/example.jpg' %}" alt="My image">
- Stored my images in `my_app/static/my_app/
I get no error when I navigate to the relevant page. Just an empty div where the image should be.
It seems like in the past, this problem has been solved by using render()
(example). However, I'm using Django 4.x, as well the render()
function.
Why aren't my images showing up?