Skip to content

Commit

Permalink
Include Django compat settings at the end of base settings, so it is …
Browse files Browse the repository at this point in the history
…applied before project settings.
  • Loading branch information
mrmachine committed Nov 13, 2020
1 parent bb6fc1d commit e8f4359
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
17 changes: 3 additions & 14 deletions ixc_django_docker/settings/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ def _(module, from_dir):
PROJECT_SETTINGS.append(
optional(os.path.join(PROJECT_SETTINGS_DIR, OVERRIDE_SETTINGS)))

# Add Django compatibility to base settings.
BASE_SETTINGS.append('django_compat.py')

# Local settings.
PROJECT_SETTINGS.append(
optional(os.path.join(PROJECT_SETTINGS_DIR, 'local.py')))
Expand Down Expand Up @@ -103,17 +106,3 @@ def _(module, from_dir):
INSTALLED_APPS = [
app for app in INSTALLED_APPS if app not in _seen and not _seen.add(app)
]

# Django <1.10 compatibility.
if django.VERSION < (1, 10):
MIDDLEWARE_CLASSES = MIDDLEWARE

# Django <1.8 compatibility.
if django.VERSION < (1, 8):
TEMPLATE_CONTEXT_PROCESSORS = [
item.replace('django.core', 'django.template')
for item in TEMPLATES[0]['OPTIONS']['context_processors']
]

TEMPLATE_DIRS = TEMPLATES[0]['DIRS']
TEMPLATE_LOADERS = TEMPLATES[0]['OPTIONS']['loaders']
13 changes: 13 additions & 0 deletions ixc_django_docker/settings/django_compat.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Django <1.10 compatibility.
if django.VERSION < (1, 10):
MIDDLEWARE_CLASSES = MIDDLEWARE

# Django <1.8 compatibility.
if django.VERSION < (1, 8):
TEMPLATE_CONTEXT_PROCESSORS = [
item.replace('django.core', 'django.template')
for item in TEMPLATES[0]['OPTIONS']['context_processors']
]

TEMPLATE_DIRS = TEMPLATES[0]['DIRS']
TEMPLATE_LOADERS = TEMPLATES[0]['OPTIONS']['loaders']

0 comments on commit e8f4359

Please sign in to comment.