Background
Websites generally need to serve additional files such as images, JavaScript, or CSS. In Django, we refer to these files as “static files”. Django provides django.contrib.staticfiles to help you manage them.
Typical use
Usually the settings file will have:
STATIC_URL = '/static/'
You can then use the following in your template:
{% load static %}
<img src="{% static "my_app/example.jpg" %}" alt="My image">
Which serves up the file off of :
my_app/static/my_app/example.jpg.
Posted by Cuauhtemoc to Python Django (2018-07-03 15:37)