misc: update settings to use TEMPLATES (#20936)

This commit is contained in:
Frédéric Péters 2018-01-01 12:41:21 +01:00
parent 999892348a
commit 7bb2caf277
2 changed files with 28 additions and 24 deletions

View File

@ -3,7 +3,6 @@
import os
DEBUG = True
TEMPLATE_DEBUG = DEBUG
PROJECT_PATH = os.path.dirname(os.path.dirname(__file__))
@ -82,13 +81,33 @@ STATICFILES_FINDERS = (
# Make this unique, and don't share it with anybody.
SECRET_KEY = 'k16cal%1fnochq4xbxqgdns-21lt9lxeof5*%j(0ief3=db32&'
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
'wcs.utils.TemplateLoader',
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
# 'django.template.loaders.eggs.Loader',
)
# Templates
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
os.path.join(PROJECT_PATH, 'wcs', 'templates'),
],
'APP_DIRS': False,
'OPTIONS': {
'context_processors': [
"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",
"wcs.context_processors.publisher",
"wcs.context_processors.response",
],
'loaders': [
'wcs.utils.TemplateLoader',
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
],
},
},
]
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
@ -108,21 +127,6 @@ ROOT_URLCONF = 'wcs.urls'
# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = 'wcs.wsgi.application'
TEMPLATE_DIRS = (
os.path.join(PROJECT_PATH, 'wcs', 'templates'),
)
TEMPLATE_CONTEXT_PROCESSORS = (
"django.core.context_processors.debug",
"django.core.context_processors.i18n",
"django.core.context_processors.media",
"django.core.context_processors.static",
"django.core.context_processors.tz",
"django.contrib.messages.context_processors.messages",
"wcs.context_processors.publisher",
"wcs.context_processors.response",
)
INSTALLED_APPS = (
#'django.contrib.auth',
#'django.contrib.contenttypes',

View File

@ -51,6 +51,6 @@ class TemplateLoader(django.template.loaders.filesystem.Loader):
template_dirs.append(theme_directory)
template_dirs = tuple(template_dirs) + settings.TEMPLATE_DIRS
template_dirs = tuple(template_dirs)
return super(TemplateLoader, self).get_template_sources(template_name, template_dirs)