From 4a7db9346417923bcb75f8e4daf7e55ef155df6f Mon Sep 17 00:00:00 2001 From: Jelle van der Waa Date: Mon, 22 May 2017 14:49:06 +0200 Subject: settings: use one import for importing path --- settings.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/settings.py b/settings.py index 4a0ca9d2..dd9384a3 100644 --- a/settings.py +++ b/settings.py @@ -1,5 +1,5 @@ -import os # Django settings for archweb project. +from os import path ## Set the debug values DEBUG = False @@ -15,7 +15,7 @@ MANAGERS = ADMINS NOTIFICATIONS = ['arch-notifications@archlinux.org'] # Full path to the data directory -DEPLOY_PATH = os.path.dirname(os.path.realpath(__file__)) +DEPLOY_PATH = path.dirname(path.realpath(__file__)) # If you set this to False, Django will not use timezone-aware datetimes. USE_TZ = True @@ -44,7 +44,6 @@ LOGIN_REDIRECT_URL = '/' # Set django's User stuff to use our profile model AUTH_PROFILE_MODULE = 'devel.UserProfile' -from os import path TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', @@ -81,11 +80,11 @@ ROOT_URLCONF = 'urls' STATIC_URL = '/static/' # Location to collect static files -STATIC_ROOT = os.path.join(DEPLOY_PATH, 'collected_static') +STATIC_ROOT = path.join(DEPLOY_PATH, 'collected_static') # Look for more static files in these locations STATICFILES_DIRS = ( - os.path.join(DEPLOY_PATH, 'sitestatic'), + path.join(DEPLOY_PATH, 'sitestatic'), ) # Static files backend that allows us to use far future Expires headers -- cgit v1.2.3-55-g3dc8 From 9f7ad1aa841ea038a1ca540624d334816b8c8e84 Mon Sep 17 00:00:00 2001 From: Jelle van der Waa Date: Mon, 22 May 2017 14:55:02 +0200 Subject: Allow templates to be debugged locally template debugging was never enabled, since TEMPLATES where defined before the local_settings where imported. So move the TEMPLATES definition under the local_settings import. --- settings.py | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/settings.py b/settings.py index dd9384a3..e59fb753 100644 --- a/settings.py +++ b/settings.py @@ -44,25 +44,6 @@ LOGIN_REDIRECT_URL = '/' # Set django's User stuff to use our profile model AUTH_PROFILE_MODULE = 'devel.UserProfile' -TEMPLATES = [ - { - 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': [ - path.join(DEPLOY_PATH, 'templates') - ], - 'APP_DIRS': True, - 'OPTIONS': { - 'debug': DEBUG, - 'context_processors': [ - 'django.contrib.auth.context_processors.auth', - 'django.core.context_processors.debug', - 'django.contrib.messages.context_processors.messages', - 'main.context_processors.secure', - ], - } - } -] - MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', @@ -189,6 +170,25 @@ try: except ImportError: pass +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [ + path.join(DEPLOY_PATH, 'templates') + ], + 'APP_DIRS': True, + 'OPTIONS': { + 'debug': DEBUG, + 'context_processors': [ + 'django.contrib.auth.context_processors.auth', + 'django.core.context_processors.debug', + 'django.contrib.messages.context_processors.messages', + 'main.context_processors.secure', + ], + } + } +] + # Enable the debug toolbar if requested if DEBUG_TOOLBAR: MIDDLEWARE_CLASSES = \ -- cgit v1.2.3-55-g3dc8