From 64b4a3daef0786b15952c96847fa2d2db0f7db5e Mon Sep 17 00:00:00 2001 From: Paul Eggleton Date: Thu, 12 Apr 2018 15:16:44 +1200 Subject: [PATCH] Use new TEMPLATES setting Django 1.8 introduced this as a soft requirement, it is a hard requirement for later Django releases. Signed-off-by: Paul Eggleton --- settings.py | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/settings.py b/settings.py index 328e3af..4edea1f 100644 --- a/settings.py +++ b/settings.py @@ -4,7 +4,6 @@ # Copyright (c) Django Software Foundation and individual contributors. DEBUG = False -TEMPLATE_DEBUG = DEBUG ADMINS = ( # ('Your Name', 'your_email@example.com'), @@ -92,13 +91,6 @@ STATICFILES_FINDERS = ( # Make this unique, and don't share it with anybody. SECRET_KEY = '' -# List of callables that know how to import templates from various sources. -TEMPLATE_LOADERS = ( - 'django.template.loaders.filesystem.Loader', - 'django.template.loaders.app_directories.Loader', -# 'django.template.loaders.eggs.Loader', -) - MIDDLEWARE_CLASSES = ( 'corsheaders.middleware.CorsMiddleware', 'django.middleware.common.CommonMiddleware', @@ -119,20 +111,30 @@ CORS_URLS_REGEX = r'.*/api/.*'; # Clickjacking protection X_FRAME_OPTIONS = 'DENY' -from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS as TCP -TEMPLATE_CONTEXT_PROCESSORS = TCP + ( - 'django.template.context_processors.request', - 'layerindex.context_processors.layerindex_context', -) - ROOT_URLCONF = 'urls' -TEMPLATE_DIRS = ( - # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". - # Always use forward slashes, even on Windows. - # Don't forget to use absolute paths, not relative paths. - BASE_DIR + "/templates", -) +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [ + BASE_DIR + "/templates", + ], + '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', + 'django.template.context_processors.request', + 'layerindex.context_processors.layerindex_context', + ], + }, + }, +] INSTALLED_APPS = ( 'django.contrib.auth',