[PATCH 08/10] settings: Add TEMPLATES setting
Stephen Finucane
stephen.finucane at intel.com
Mon Jan 11 10:07:57 AEDT 2016
This was added in Django 1.8 and will be required by Django 1.10.
https://docs.djangoproject.com/en/1.9/ref/templates/upgrading/#the-templates-settings
Signed-off-by: Stephen Finucane <stephen.finucane at intel.com>
---
patchwork/settings/base.py | 27 +++++++++++++++++++++++++--
patchwork/settings/dev.py | 5 ++++-
2 files changed, 29 insertions(+), 3 deletions(-)
diff --git a/patchwork/settings/base.py b/patchwork/settings/base.py
index ae93622..5f51e47 100644
--- a/patchwork/settings/base.py
+++ b/patchwork/settings/base.py
@@ -61,9 +61,32 @@ ROOT_URLCONF = 'patchwork.urls'
# Templates
-TEMPLATE_DIRS = (
+_TEMPLATE_DIRS = [
os.path.join(ROOT_DIR, 'templates'),
-)
+]
+
+if django.VERSION >= (1, 8):
+ TEMPLATES = [
+ {
+ 'BACKEND': 'django.template.backends.django.DjangoTemplates',
+ 'DIRS': _TEMPLATE_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',
+ ],
+ },
+ },
+ ]
+else:
+ TEMPLATE_DIRS = _TEMPLATE_DIRS
+
# Email
diff --git a/patchwork/settings/dev.py b/patchwork/settings/dev.py
index 3ecdb06..20626c6 100644
--- a/patchwork/settings/dev.py
+++ b/patchwork/settings/dev.py
@@ -28,7 +28,10 @@ DEBUG = True
# Templates
-TEMPLATE_DEBUG = True
+if django.VERSION < (1, 8):
+ # In Django 1.8+, this is only necessary if the value differs from
+ # the value for 'DEBUG'
+ TEMPLATE_DEBUG = True
# Database
--
2.0.0
More information about the Patchwork
mailing list