python - Load static files for all templates in django -
is there way in django not need {% load static %}
@ top of every template?
this question indicates can factor out common load tags settings, doesn't give particulars need in case.
as of django 1.9, can add following template settings:
'builtins': ['django.contrib.staticfiles.templatetags.staticfiles']
for example, whole template setting might this:
templates = [ { 'backend': 'django.template.backends.django.djangotemplates', 'dirs': [], 'app_dirs': true, 'options': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], 'builtins': [ 'django.contrib.staticfiles.templatetags.staticfiles', ], }, }, ]
Comments
Post a Comment