Skip to content

Commit 4d41674

Browse files
committed
1 parent e495c15 commit 4d41674

File tree

1 file changed

+32
-25
lines changed

1 file changed

+32
-25
lines changed

mygpo/settings.py

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ def get_bool(name, default):
3131

3232
DEBUG = get_bool('DEBUG', False)
3333

34-
TEMPLATE_DEBUG = DEBUG
35-
3634
ADMINS = re.findall(r'\s*([^<]+) <([^>]+)>\s*', os.getenv('ADMINS', ''))
3735

3836
MANAGERS = ADMINS
@@ -79,12 +77,38 @@ def get_bool(name, default):
7977
os.path.abspath(os.path.join(BASE_DIR, '..', 'htdocs', 'media')),
8078
)
8179

82-
# List of callables that know how to import templates from various sources.
83-
TEMPLATE_LOADERS = (
84-
('django.template.loaders.cached.Loader', (
85-
'django.template.loaders.app_directories.Loader',
86-
)),
87-
)
80+
81+
TEMPLATES = [{
82+
'BACKEND': 'django.template.backends.django.DjangoTemplates',
83+
'DIRS': [],
84+
'OPTIONS': {
85+
'context_processors': [
86+
'django.contrib.auth.context_processors.auth',
87+
'django.template.context_processors.debug',
88+
'django.template.context_processors.i18n',
89+
'django.template.context_processors.media',
90+
'django.template.context_processors.static',
91+
'django.template.context_processors.tz',
92+
'django.contrib.messages.context_processors.messages',
93+
'mygpo.web.google.analytics',
94+
'mygpo.web.google.adsense',
95+
# make the debug variable available in templates
96+
# https://docs.djangoproject.com/en/dev/ref/templates/api/#django-core-context-processors-debug
97+
'django.core.context_processors.debug',
98+
99+
# required so that the request obj can be accessed from
100+
# templates. this is used to direct users to previous
101+
# page after login
102+
'django.core.context_processors.request',
103+
],
104+
'loaders': [
105+
('django.template.loaders.cached.Loader', [
106+
'django.template.loaders.app_directories.Loader',
107+
]),
108+
],
109+
},
110+
}]
111+
88112

89113
MIDDLEWARE_CLASSES = (
90114
'django.middleware.common.CommonMiddleware',
@@ -97,8 +121,6 @@ def get_bool(name, default):
97121

98122
ROOT_URLCONF = 'mygpo.urls'
99123

100-
TEMPLATE_DIRS = ()
101-
102124
INSTALLED_APPS = (
103125
'django.contrib.contenttypes',
104126
'django.contrib.messages',
@@ -171,21 +193,6 @@ def get_bool(name, default):
171193
SESSION_SERIALIZER = 'django.contrib.sessions.serializers.PickleSerializer'
172194

173195

174-
from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS
175-
176-
TEMPLATE_CONTEXT_PROCESSORS += (
177-
"mygpo.web.google.analytics",
178-
"mygpo.web.google.adsense",
179-
180-
# make the debug variable available in templates
181-
# https://docs.djangoproject.com/en/dev/ref/templates/api/#django-core-context-processors-debug
182-
"django.core.context_processors.debug",
183-
184-
# required so that the request obj can be accessed from templates.
185-
# this is used to direct users to previous page after login
186-
'django.core.context_processors.request',
187-
)
188-
189196
MESSAGE_STORAGE = 'django.contrib.messages.storage.session.SessionStorage'
190197

191198
USER_CLASS = 'mygpo.users.models.User'

0 commit comments

Comments
 (0)