Changed settings to use the new TEMPLATES dictionary instead of the deprecated individual TEMPLATE_* settings.

- Legacy-Id: 12444
This commit is contained in:
Henrik Levkowetz 2016-12-05 12:53:21 +00:00
parent cec0f33817
commit be272a019a

View file

@ -21,7 +21,6 @@ from ietf import __version__
import debug
DEBUG = True
TEMPLATE_DEBUG = DEBUG
debug.debug = DEBUG
# Valid values:
@ -216,13 +215,38 @@ SESSION_SAVE_EVERY_REQUEST = True
PREFERENCES_COOKIE_AGE = 60 * 60 * 24 * 365 * 50 # Age of cookie, in seconds: 50 years
TEMPLATE_LOADERS = (
('django.template.loaders.cached.Loader', (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
)),
'ietf.dbtemplate.template.Loader',
)
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
BASE_DIR + "/templates",
BASE_DIR + "/secr/templates",
],
'OPTIONS': {
'context_processors': [
'django.contrib.auth.context_processors.auth',
'django.template.context_processors.debug',
'django.template.context_processors.i18n',
'django.template.context_processors.request',
'django.template.context_processors.media',
#'django.template.context_processors.tz',
'django.contrib.messages.context_processors.messages',
'ietf.context_processors.server_mode',
'ietf.context_processors.debug_mark_queries_from_view',
'ietf.context_processors.revision_info',
'ietf.secr.context_processors.secr_revision_info',
'ietf.context_processors.rfcdiff_base_url',
],
'loaders': [
('django.template.loaders.cached.Loader', (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
)),
'ietf.dbtemplate.template.Loader',
]
},
},
]
MIDDLEWARE_CLASSES = (
'django.middleware.csrf.CsrfViewMiddleware',
@ -240,25 +264,6 @@ MIDDLEWARE_CLASSES = (
ROOT_URLCONF = 'ietf.urls'
TEMPLATE_DIRS = (
BASE_DIR + "/templates",
BASE_DIR + "/secr/templates",
)
TEMPLATE_CONTEXT_PROCESSORS = (
'django.contrib.auth.context_processors.auth',
'django.core.context_processors.debug',
'django.core.context_processors.i18n',
'django.core.context_processors.request',
'django.core.context_processors.media',
'django.contrib.messages.context_processors.messages',
'ietf.context_processors.server_mode',
'ietf.context_processors.debug_mark_queries_from_view',
'ietf.context_processors.revision_info',
'ietf.secr.context_processors.secr_revision_info',
'ietf.context_processors.rfcdiff_base_url',
)
# Additional locations of static files (in addition to each app's static/ dir)
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'static'),
@ -755,7 +760,7 @@ for app in INSTALLED_APPS:
# Add DEV_APPS to INSTALLED_APPS
INSTALLED_APPS += DEV_APPS
MIDDLEWARE_CLASSES += DEV_MIDDLEWARE_CLASSES
TEMPLATE_CONTEXT_PROCESSORS += DEV_TEMPLATE_CONTEXT_PROCESSORS
TEMPLATES[0]['OPTIONS']['context_processors'] += DEV_TEMPLATE_CONTEXT_PROCESSORS
# We provide a secret key only for test and development modes. It's
@ -764,7 +769,9 @@ TEMPLATE_CONTEXT_PROCESSORS += DEV_TEMPLATE_CONTEXT_PROCESSORS
# publicly available, for instance from the source repository.
if SERVER_MODE != 'production':
# stomp out the cached template loader, it's annoying
TEMPLATE_LOADERS = tuple(l for e in TEMPLATE_LOADERS for l in (e[1] if isinstance(e, tuple) and "cached.Loader" in e[0] else (e,)))
loaders = TEMPLATES[0]['OPTIONS']['loaders']
loaders = tuple(l for e in loaders for l in (e[1] if isinstance(e, tuple) and "cached.Loader" in e[0] else (e,)))
TEMPLATES[0]['OPTIONS']['loaders'] = loaders
CACHES = {
'default': {