From 12e98ffacfd14a2baace2873c77c003e3ef86330 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Sat, 9 Sep 2017 13:41:51 +0200 Subject: [PATCH] misc: update to use new TEMPLATES settings (#19578) --- combo/settings.py | 31 ++++++++++++++++++++++++------- combo/wsgi.py | 2 +- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/combo/settings.py b/combo/settings.py index 16e600d..1c5b3c5 100644 --- a/combo/settings.py +++ b/combo/settings.py @@ -41,8 +41,6 @@ SECRET_KEY = 'r^(w+o4*txe1=t+0w*w3*9%idij!yeq1#axpsi4%5*u#3u&)1t' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True -TEMPLATE_DEBUG = True - ALLOWED_HOSTS = [] @@ -100,11 +98,30 @@ MIDDLEWARE_CLASSES = ( ) # Serve xstatic files, required for gadjo -STATICFILES_FINDERS = global_settings.STATICFILES_FINDERS + \ - ('gadjo.finders.XStaticFinder',) - -TEMPLATE_CONTEXT_PROCESSORS = global_settings.TEMPLATE_CONTEXT_PROCESSORS + \ - ('combo.context_processors.template_vars',) +STATICFILES_FINDERS = list(global_settings.STATICFILES_FINDERS) + \ + ['gadjo.finders.XStaticFinder'] + +# Templates +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [ + ], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.contrib.auth.context_processors.auth', + 'django.template.context_processors.debug', + 'django.template.context_processors.i18n', + 'django.template.context_processors.media', + 'django.template.context_processors.static', + 'django.template.context_processors.tz', + 'django.contrib.messages.context_processors.messages', + 'combo.context_processors.template_vars', + ], + }, + }, +] ROOT_URLCONF = 'combo.urls' diff --git a/combo/wsgi.py b/combo/wsgi.py index f9c59ed..6219669 100644 --- a/combo/wsgi.py +++ b/combo/wsgi.py @@ -13,7 +13,7 @@ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "combo.settings") from django.conf import settings from django.core.wsgi import get_wsgi_application application = get_wsgi_application() -if 'hobo.context_processors.statics_hash' in settings.TEMPLATE_CONTEXT_PROCESSORS: +if 'hobo.context_processors.statics_hash' in settings.TEMPLATES[0]['OPTIONS']['context_processors']: # initialize versions as soon as possible as it may be used in most # requests via the statics_hash template var and we prefer not to # load the information during a user request. -- 2.15.0.rc1