2👍
There is no overhead. load static
does not “load and reload static files”; it just makes available the (already-loaded) code in the staticfiles templatetags library for use in your template.
4👍
You have to write the tag in every template. In case of performance, you need not to worry as it never reloads or loads a separate new copy of static files.
- [Django]-(Django and PIL) encoder error -2 when writing image file
- [Django]-Location widget in messenger platform displays a search bar in mobile version but not in Desktop Version
2👍
By using load you adding tags and filters from some app into the context for the current template. It just calls parser.add_library()
for parser and updates the list of tags and filters for this particular template. You can check this method, and it gets called from load tag
If you don’t want to load something you can add it in the builtins. For Django 1.9 you can configure it like this
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'builtins': ['django.templatetags.static'],
},
},
]
and for older versions
from django.template.loader import add_to_builtins
add_to_builtins('django.templatetags.static')
- [Django]-MySQL database being hit too many times with django query
- [Django]-How to remove get parameter from url in django view
- [Django]-Urls.py redirect with URL reversal and parameters — is there any easier way?