-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsettings.py
232 lines (206 loc) · 7.41 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
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
# This file should not be edited (as it is apart of the project)
# Any customization of these settings should be within settings_local.py
import os
import sys
MAP_VERSION = "1.17.0"
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
APP_FOLDER = os.path.join(BASE_DIR, 'apps')
INC_FOLDER = os.path.join(BASE_DIR, 'third-party')
ROOT_URLCONF = 'urls'
LOGIN_URL = '/admin/'
# Add local apps folder to python path
sys.path.append(APP_FOLDER)
sys.path.append(INC_FOLDER)
TIME_ZONE = 'America/New_York'
LANGUAGE_CODE = 'en-us'
SITE_ID = 1
USE_I18N = False
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
os.path.join(BASE_DIR, 'templates')
],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'apps.map_context',
'django.contrib.auth.context_processors.auth',
'django.template.context_processors.debug',
'django.template.context_processors.i18n',
'django.template.context_processors.media',
'django.template.context_processors.request',
'django.contrib.messages.context_processors.messages',
'django.template.context_processors.static'
],
},
},
]
MIDDLEWARE_CLASSES = [
'api.MonkeyPatchHttpRequest',
'api.MapMiddleware',
'apps.DisableCSRF', # :(
'apps.SecureRequiredMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
]
WSGI_APPLICATION = 'wsgi.application'
INSTALLED_APPS = (
'core',
'campus',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.staticfiles',
'django.contrib.sites',
'django.contrib.humanize'
)
TINYMCE_DEFAULT_CONFIG = {
'theme': "advanced",
'theme_advanced_buttons1' : "%s,|,%s,|,%s,|,%s" % (
"bold,italic,underline",
"bullist,numlist,link|,outdent,indent,blockquote",
"justifyleft,justifycenter,justifyright,justifyfull",
"formatselect,|,removeformat,code" ),
'theme_advanced_buttons2' : "",
'theme_advanced_buttons3' : "",
'theme_advanced_buttons4' : "",
'theme_advanced_toolbar_location' : "top",
'theme_advanced_toolbar_align' : "left",
'theme_advanced_statusbar_location' : "bottom",
'theme_advanced_resizing' : True,
}
LOGGING = {
'version':1,
'disable_existing_loggers':True,
'filters': {
'require_debug_true': {
'()': 'logs.RequiredDebugTrue',
},
'require_debug_false': {
'()': 'logs.RequiredDebugFalse',
}
},
'formatters': {
'concise': {
'format': '\t'.join(['%(levelname)s','%(asctime)s','%(message)s']),
},
'talkative': {
'format': '\t'.join(['%(levelname)s','%(asctime)s','%(funcName)s','%(lineno)d','%(message)s']),
},
# Request Specific Formatters
'request_console_formatter':{
'format': '\t'.join(['%(levelname)s','%(asctime)s','%(message)s','%(exc_info)s']),
},
'request_file_formatter':{
'format': '\t'.join(['%(levelname)s','%(asctime)s','%(message)s','%(exc_info)s']),
},
},
'handlers': {
'discard': {
'level': 'ERROR',
'class': 'logging.NullHandler'
},
'console': {
'level': 'ERROR',
'class': 'logging.StreamHandler',
'formatter': 'concise',
'filters': ['require_debug_true']
},
'file': {
'level': 'ERROR',
'class': 'logging.handlers.RotatingFileHandler',
'filename': '%s/application.log' % os.path.join(BASE_DIR, 'logs'),
'maxBytes': 1024*1024*10, # 10 MB
'backupCount': 5,
'formatter': 'concise',
'filters': ['require_debug_false']
},
# Request Specific Handlers
'console_request': {
'level': 'ERROR',
'class': 'logging.StreamHandler',
'formatter': 'request_console_formatter',
'filters': ['require_debug_true']
},
'file_request': {
'level': 'ERROR',
'class': 'logging.handlers.RotatingFileHandler',
'filename': '%s/request.log' % os.path.join(BASE_DIR, 'logs'),
'maxBytes': 1024*1024*10, # 10 MB
'backupCount': 5,
'formatter': 'request_file_formatter',
'filters': ['require_debug_false']
}
},
'loggers': {
'django.db.backends': { # Supress SQL debug messages
'handlers': ['discard'],
'level': 'ERROR',
'propagate': False
},
'django.request': {
'handlers': ['console_request', 'file_request'],
'level': 'ERROR',
'propagate': False
},
'': {
'handlers': ['console', 'file'],
'level': 'ERROR',
'propagate': False
},
}
}
# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/var/www/example.com/media/"
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://example.com/media/", "http://media.example.com/"
MEDIA_URL = '/media/'
# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/var/www/example.com/static/"
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
# URL prefix for static files.
# Example: "http://example.com/static/", "http://static.example.com/"
STATIC_URL = '/static/'
# Additional locations of static files
STATICFILES_DIRS = (
# Put strings here, like "/home/html/static" or "C:/www/django/static".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
os.path.join(BASE_DIR, 'static_files'),
)
# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
# For Google to render KML layers, it needs to import the map data. If working
# locally or behind a firewall, this will not be possible. If GOOGLE_CAN_SEE_ME
# if false, will fall back to GOOGLE_LOOK_HERE (leave off trailing slash)
GOOGLE_CAN_SEE_ME = True
GOOGLE_LOOK_HERE = "https://map.ucf.edu"
# TODO: open all data to be indexed by a real search engine, otherwise
# search returns a very basic (nearly useless) keymatch result
SEARCH_ENGINE = None
LOGIN_REDIRECT_URL = '/admin/'
TEST_RUNNER = 'utils.DisableLoggingTestRunner'
REQUEST_TIMEOUT = 30
try:
from settings_local import *
except ImportError:
from django.core.exceptions import ImproperlyConfigured
raise ImproperlyConfigured(
'Local settings file was not found. ' +
'Ensure settings_local.py exists in project root.'
)