From 6b95646cc77db290de39bf5afc8e537054ac4c46 Mon Sep 17 00:00:00 2001 From: Ben Sturmfels Date: Thu, 5 Oct 2023 17:35:18 +1100 Subject: [PATCH] Move TEMPLATES, AUTHENTICATION_BACKENDS and MIDDLEWARE into base settings These don't change, so belong in the base settings. --- www/conservancy/settings.py | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/www/conservancy/settings.py b/www/conservancy/settings.py index 93167960..57dd68fd 100644 --- a/www/conservancy/settings.py +++ b/www/conservancy/settings.py @@ -100,3 +100,39 @@ INSTALLED_APPS = [ ] DEFAULT_AUTO_FIELD = 'django.db.models.AutoField' + +_conservancy_root_dir = Path(__file__).resolve().parent / 'conservancy' +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [ + _conservancy_root_dir / 'templates', + _conservancy_root_dir / 'static', + ], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + 'conservancy.local_context_processors.host_url', + 'conservancy.local_context_processors.sitefundraiser', + ] + } + } +] + +AUTHENTICATION_BACKENDS = ( +# 'conservancy.auth.LDAPBackend', +'django.contrib.auth.backends.ModelBackend', +) + +MIDDLEWARE = [ + 'django.middleware.common.CommonMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'conservancy.middleware.ForceCanonicalHostnameMiddleware', + # 'django.middleware.doc.XViewMiddleware', +]