use TEMPLATES settings (#24880)

This commit is contained in:
Emmanuel Cazenave 2018-06-29 14:32:05 +02:00
parent 06dd93abfd
commit df81098dff
3 changed files with 30 additions and 18 deletions

View File

@ -11,7 +11,7 @@ DEBUG = False
STATIC_ROOT = '/var/lib/authentic2/collectstatic/'
STATICFILES_DIRS = ('/var/lib/authentic2/static',) + STATICFILES_DIRS
TEMPLATE_DIRS = ('/var/lib/authentic2/templates',) + TEMPLATE_DIRS
TEMPLATES[0]['DIRS'] = ['/var/lib/authentic2/templates'] + TEMPLATES[0]['DIRS']
LOCALE_PATHS = ('/var/lib/authentic2/locale',) + LOCALE_PATHS
ADMINS = (('root', 'root@localhost'),)
@ -197,8 +197,12 @@ def extract_settings_from_environ():
for path_env in PATH_ENVS:
if path_env in os.environ:
old = globals().get(path_env)
globals()[path_env] = tuple(os.environ[path_env].split(':')) + tuple(old)
if path_env == 'TEMPLATE_DIRS':
old = globals()['TEMPLATES']['DIRS']
globals()['TEMPLATES']['DIRS'] = list(os.environ[path_env].split(':')) + old
else:
old = globals().get(path_env)
globals()[path_env] = tuple(os.environ[path_env].split(':')) + tuple(old)
INT_ENVS = (
'SESSION_COOKIE_AGE',

View File

@ -13,7 +13,6 @@
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
TEMPLATE_DEBUG = False
#ADMINS = (
# # ('User 1', 'watchdog@example.net'),

View File

@ -22,7 +22,6 @@ SECRET_KEY = 'please-change-me-with-a-very-long-random-string'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
DEBUG_DB = False
TEMPLATE_DEBUG = False
MEDIA = 'media'
# See https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts
@ -49,17 +48,29 @@ USE_TZ = True
STATIC_URL = '/static/'
TEMPLATE_CONTEXT_PROCESSORS = (
'django.contrib.auth.context_processors.auth',
'django_rbac.context_processors.auth',
'django.core.context_processors.debug',
'django.core.context_processors.i18n',
'django.core.context_processors.media',
'django.core.context_processors.request',
'django.contrib.messages.context_processors.messages',
'django.core.context_processors.static',
'authentic2.context_processors.a2_processor',
)
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
os.path.join(BASE_DIR, 'templates'),
],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.contrib.auth.context_processors.auth',
'django_rbac.context_processors.auth',
'django.core.context_processors.debug',
'django.core.context_processors.i18n',
'django.core.context_processors.media',
'django.core.context_processors.request',
'django.contrib.messages.context_processors.messages',
'django.core.context_processors.static',
'authentic2.context_processors.a2_processor',
],
},
},
]
MIDDLEWARE_CLASSES = (
'authentic2.middleware.StoreRequestMiddleware',
@ -89,8 +100,6 @@ MIDDLEWARE_CLASSES = plugins.register_plugins_middleware(MIDDLEWARE_CLASSES)
ROOT_URLCONF = 'authentic2.urls'
TEMPLATE_DIRS = (os.path.join(BASE_DIR, 'templates'),)
STATICFILES_DIRS = (os.path.join(BASE_DIR, 'static'),)
STATICFILES_FINDERS = list(global_settings.STATICFILES_FINDERS) + ['gadjo.finders.XStaticFinder']