This repository was archived by the owner on Feb 26, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathsettings.py
More file actions
114 lines (94 loc) · 2.77 KB
/
Copy pathsettings.py
File metadata and controls
114 lines (94 loc) · 2.77 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# coding=UTF-8
import os
import json
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
def env_var(key, default=None):
"""Retrieves env vars and makes Python boolean replacements"""
val = os.environ.get(key, default)
if val == 'True':
val = True
elif val == 'False':
val = False
elif val == 'None':
val = None
return val
BASE_LAYER_DIR = os.path.join(BASE_DIR, "baselayers")
BASE_LAYERS = {}
for filename in os.listdir(BASE_LAYER_DIR):
base, ext = os.path.splitext(filename)
if ext == ".xml":
BASE_LAYERS[base] = filename
BASE_LAYERS_ATTRIBUTION = {}
try:
with open(os.path.join(BASE_LAYER_DIR, "attribution.json"), "r") as f:
BASE_LAYERS_ATTRIBUTION = json.load(f)
except Exception, e:
print "Error loading baselayers %s" % e
ATTRIBUTION_FONT = os.path.join(BASE_DIR, "fonts/Raleway-Regular.ttf")
ATTRIBUTION_FONT_SIZE = 10
MAX_IMAGE_DIMENSION = env_var('MAX_IMAGE_DIMENSION', 1024)
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'lr&)s39c&v@^0&%57zlwe_h3e_un*e*^xurh95rjzz=q6zkn^b'
DEBUG = env_var("DEBUG", False)
TEMPLATE_DEBUG = DEBUG
ALLOWED_HOSTS = ['*']
INSTALLED_APPS = (
'django.contrib.gis',
'mapRender',
)
MIDDLEWARE_CLASSES = ()
ROOT_URLCONF = 'staticMaps.urls'
WSGI_APPLICATION = 'wsgi.application'
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = False
USE_L10N = False
USE_TZ = False
# logging
LOG_LEVEL = 'INFO'
if DEBUG:
LOG_LEVEL = 'DEBUG'
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'verbose': {
'format' : "[%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] %(message)s",
'datefmt' : "%d/%b/%Y %H:%M:%S"
},
'simple': {
'format': '%(levelname)s %(message)s'
},
'syslog': {
'format': ('staticmaps %(asctime)s [%(process)d] [%(levelname)s] ' +
'%(filename)s:%(lineno)s:%(funcName)s %(message)s'),
'datefmt': '%Y-%m-%d %H:%M:%S'
},
},
'handlers': {
'console': {
'level': LOG_LEVEL,
'class': 'logging.StreamHandler',
'formatter': 'verbose'
},
},
'loggers': {
'': {
'handlers': ['console'],
'level': 'DEBUG',
'propagate': True,
},
}
}
if env_var("LOGGING_SYSLOG", False) and os.path.exists("/dev/log"):
# If rsyslogd is running, use it
LOGGING["handlers"]["syslog"] = {
'level': 'DEBUG',
'class': 'logging.handlers.SysLogHandler',
'formatter': 'syslog',
'filters': ['user'],
'facility': 'local5',
'address': '/dev/log',
}
for (key, val) in LOGGING["loggers"].items():
val["handlers"][0] = "syslog"