The built-in static
template tag "link[s] to static files that are saved in STATIC_ROOT
".
The staticfiles
contrib app's static
template tag "uses the configured STATICFILES_STORAGE
storage to create the full URL for the given relative path", which is "especially useful when using a non-local storage backend to deploy files".
The built-in static
template tag's documentation (linked to above) has a note that says to use the staticfiles
contrib app's static
template tag "if you have an advanced use case such as using a cloud service to serve static files", and it gives this example of doing so:
{% load static from staticfiles %}
<img src="{% static "images/hi.jpg" %}" alt="Hi!" />
You could use {% load staticfiles %}
rather than {% load static from staticfiles %}
if you want, but the latter is more explicit.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…