Skip to content

Instantly share code, notes, and snippets.

@beniwohli
Last active October 20, 2015 13:02
Show Gist options
  • Save beniwohli/fee1397d56f623172adc to your computer and use it in GitHub Desktop.
Save beniwohli/fee1397d56f623172adc to your computer and use it in GitHub Desktop.
override template debug in Django 1.8+
with override_settings(
TEMPLATES=[
{
'BACKEND': settings.TEMPLATES[0]['BACKEND'],
'DIRS': settings.TEMPLATES[0]['DIRS'],
'OPTIONS': {
'context_processors': settings.TEMPLATES[0]['OPTIONS']['context_processors'],
'loaders': settings.TEMPLATES[0]['OPTIONS']['loaders'],
'debug': True,
},
},
]
):
from copy import deepcopy
TEMPLATES_copy = deepcopy(settings.TEMPLATES)
TEMPLATES_copy[0]['OPTIONS']['debug'] = True
with override_settings(
TEMPLATES=TEMPLATES_copy
):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment