Is there a way in django to not need the {% load static %}
at the top of every template?
This question indicates you can factor out common load tags into settings, but doesn't give the particulars you need in this case.
Is there a way in django to not need the {% load static %}
at the top of every template?
This question indicates you can factor out common load tags into settings, but doesn't give the particulars you need in this case.
As of Django 1.9, you can add a
builtins
key to yourTEMPLATES["OPTIONS"]
insettings.py
.For Django 2.1+, use:
For Django 1.9 - 2.0 (this will work up until 2.2, after which it is deprecated), use:
For example, the whole template setting might look like this:
Thanks to @ZachPlachue for the Django 3 update.
The previous answer's method is deprecated as of Django 3.0. (see : https://docs.djangoproject.com/en/3.0/releases/3.0/#features-removed-in-3-0)
Now you'd need to add the following to your template settings:
This is the updated templates setting: