-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.py
43 lines (33 loc) · 1.54 KB
/
settings.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import os
## Import our defaults (globals)
from conf.settings.default import *
## Inherit from environment specifics
DJANGO_CONF = os.environ.get('DJANGO_CONF', 'default')
if DJANGO_CONF != 'default':
module = __import__(DJANGO_CONF, globals(), locals(), ['*'])
for k in dir(module):
locals()[k] = getattr(module, k)
## Import local settings
try:
from local_settings import *
except ImportError:
import sys, traceback
sys.stderr.write("Warning: Can't find the file 'local_settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file local_settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__)
sys.stderr.write("\nFor debugging purposes, the exception was:\n\n")
traceback.print_exc()
## Remove disabled apps
if 'DISABLED_APPS' in locals():
INSTALLED_APPS = [k for k in INSTALLED_APPS if k not in DISABLED_APPS]
MIDDLEWARE_CLASSES = list(MIDDLEWARE_CLASSES)
DATABASE_ROUTERS = list(DATABASE_ROUTERS)
TEMPLATE_CONTEXT_PROCESSORS = list(TEMPLATE_CONTEXT_PROCESSORS)
for a in DISABLED_APPS:
for x, m in enumerate(MIDDLEWARE_CLASSES):
if m.startswith(a):
MIDDLEWARE_CLASSES.pop(x)
for x, m in enumerate(TEMPLATE_CONTEXT_PROCESSORS):
if m.startswith(a):
TEMPLATE_CONTEXT_PROCESSORS.pop(x)
for x, m in enumerate(DATABASE_ROUTERS):
if m.startswith(a):
DATABASE_ROUTERS.pop(x)