'Cannot get images to load in django

I cannot get an image to load in Django by following the documentation.

I have the following directory structure:

enter image description here

And here is a snippet of my code within backend/views.py:

def landing(request):
    template = loader.get_template(os.path.join(os.getcwd(), 'templates', 'backend', 'index.html'))
    context = {}
    return HttpResponse(template.render(context, request))

I have an HTML file within templates/backend/index.html:

{% load static %}
<img src="{% static 'backend/example.jpg' %}" alt="My Image">

Any idea what might be missing?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source