1
|
import os.path
|
2
|
|
3
|
PROJECT_PATH = os.path.dirname(os.path.dirname(__file__))
|
4
|
|
5
|
from common import *
|
6
|
from calebasse import *
|
7
|
|
8
|
#########################################################################
|
9
|
# Import settings from local_settings.py, if it exists.
|
10
|
#
|
11
|
# Put this at the end of settings.py
|
12
|
|
13
|
try:
|
14
|
import local_settings
|
15
|
except ImportError:
|
16
|
print """
|
17
|
-------------------------------------------------------------------------
|
18
|
You need to create a local_settings.py file which needs to contain at least
|
19
|
database connection information.
|
20
|
|
21
|
Copy local_settings_example.py to local_settings.py and edit it.
|
22
|
-------------------------------------------------------------------------
|
23
|
"""
|
24
|
import sys
|
25
|
sys.exit(1)
|
26
|
else:
|
27
|
# Import any symbols that begin with A-Z. Append to lists any symbols that
|
28
|
# begin with "EXTRA_".
|
29
|
import re
|
30
|
for attr in dir(local_settings):
|
31
|
match = re.search('^EXTRA_(\w+)', attr)
|
32
|
if match:
|
33
|
name = match.group(1)
|
34
|
value = getattr(local_settings, attr)
|
35
|
try:
|
36
|
globals()[name] += value
|
37
|
except KeyError:
|
38
|
globals()[name] = value
|
39
|
elif re.search('^[A-Z]', attr):
|
40
|
globals()[attr] = getattr(local_settings, attr)
|