Commit | Line | Data |
---|---|---|
6837e829 PH |
1 | import sys |
2 | import glob | |
3 | import types | |
01b54c21 | 4 | |
6837e829 | 5 | from os.path import abspath, dirname, join |
01b54c21 | 6 | |
6837e829 | 7 | from django.conf.global_settings import * # NOQA |
01b54c21 | 8 | |
6837e829 | 9 | PROJECT_DIR = abspath(dirname(__file__)) |
01b54c21 | 10 | |
6837e829 PH |
11 | conffiles = glob.glob(join(PROJECT_DIR, 'settings', '*.py')) |
12 | conffiles.sort() | |
01b54c21 | 13 | |
6837e829 PH |
14 | for f in conffiles: |
15 | exec(open(abspath(f)).read()) | |
01b54c21 | 16 | |
6837e829 PH |
17 | # from https://github.com/2general/django-split-settings/blob/master/split_settings/tools.py |
18 | # add dummy modules to sys.modules to make runserver autoreload work with | |
19 | # settings components | |
20 | modulename = '_settings.%s' % f | |
21 | module = types.ModuleType(modulename) | |
22 | module.__file__ = f | |
23 | sys.modules[modulename] = module | |
01b54c21 | 24 | |
6837e829 PH |
25 | try: |
26 | from conf import * | |
27 | except ImportError: | |
28 | pass |