Installation
$ [sudo] pip install django-templates-variables
settings.py
INSTALLED_APPS+= [
'django_templates_variables'
]
TEMPLATES = [
{
# …
'OPTIONS': {
'context_processors': [
'django_templates_variables.context_processors.templates_variables',
],
},
},
]
Examples
settings.py
TEMPLATES_VARIABLES = dict(
settings = dict(
DEBUG=DEBUG,
VAR="VALUE"
)
)
template.html
:
{% if settings.DEBUG %}
{{ settings.VAR }}
{% endif %}