-
Notifications
You must be signed in to change notification settings - Fork 0
/
siteSettings.py
437 lines (349 loc) · 16.6 KB
/
siteSettings.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
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
#__BEGIN_LICENSE__
# Copyright (c) 2015, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All rights reserved.
#
# The xGDS platform is licensed under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0.
#
# Unless required by applicable law or agreed to in writing, software distributed
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.
#__END_LICENSE__
# siteSettings.py -- site default settings
#
# This contains the default settings for the site-level django app. This will
# override any application-default settings and define the default set of
# installed applications. This should be a full settings.py file which needs
# minimal overrides by the settings.py file for the application to actually
# function.
#
# As a bare minimum, please edit INSTALLED_APPS!
#
# This file *should* be checked into git.
import importlib
import os
import sys
from django.conf import global_settings
from django.core.urlresolvers import reverse
from geocamUtil.SettingsUtil import getOrCreateDict, getOrCreateArray, HOSTNAME
XGDS_SITE_APP = "xgds_demo_app"
SITE_TITLE = 'xGDS Demo' # the name of your research project, your brand
# Make this unique, and don't share it with anybody.
SECRET_KEY = '***REMOVED***'
FAVICON_PATH = "xgds_core/icons/favicon.ico"
# from apps.basaltApp.instrumentDataImporters import *
# apps should be listed from "most specific" to "most general". that
# way, templates in more specific apps override ones from more general
# apps.
INSTALLED_APPS = ['django_npm_apps',
XGDS_SITE_APP,
# TODO uncomment the submodules that you are including
# 'xgds_sample',
# 'xgds_instrument',
'xgds_planner2',
'xgds_image',
# 'xgds_video',
# 'xgds_plot',
# 'xgds_status_board',
'xgds_notes2',
'xgds_map_server',
'deepzoom', # needed for xgds_image
'geocamTrack',
'xgds_core',
'geocamPycroraptor2',
'geocamUtil',
'pipeline',
'taggit',
'resumable',
'django_markwhat',
'dal',
'dal_select2',
'rest_framework.authtoken',
'rest_framework',
'corsheaders',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
]
for app in reversed(INSTALLED_APPS):
try:
appSettings = importlib.import_module(app + ".defaultSettings")
for key, val in vars(appSettings).iteritems():
if not key.startswith('_'):
globals()[key] = val
except:
pass
USING_DJANGO_DEV_SERVER = ('runserver' in sys.argv)
USE_STATIC_SERVE = USING_DJANGO_DEV_SERVER
SCRIPT_NAME = os.environ['DJANGO_SCRIPT_NAME'] # set in sourceme.sh
if USING_DJANGO_DEV_SERVER:
# django dev server deployment won't work with other SCRIPT_NAME settings
SCRIPT_NAME = '/'
XGDS_PLANNER_SCHEMAS = {
# "test": {
# "schemaSource": "apps/xgds_planner2/testing/examplePlanSchema.json",
# "librarySource": "apps/xgds_planner2/testing/examplePlanLibrary.json",
# "simulatorUrl": "xgds_planner2/testing/exampleSimulator.js",
# "simulator": "xgds_planner2.ExampleSimulator",
# },
"GenericVehicle": {
"schemaSource": "apps/xgds_planner2/js/xgds_planner2/planner/genericVehiclePlanSchema.json",
"librarySource": "apps/xgds_demo_app/static/xgds_planner2/js/xgds_planner2/planner/genericVehiclePlanLibrary.json",
"simulatorUrl": "apps/xgds_planner2/js/planner/genericVehicleSimulator.js",
"simulator": "genericVehicle.Simulator", # the namespace within the simulator js
}
}
DEBUG = True
# TEMPLATE_DEBUG = DEBUG
PROJ_ROOT = os.path.abspath(os.path.dirname(__file__))
if not PROJ_ROOT.endswith('/'):
PROJ_ROOT += '/'
# Python path is agnostic to what the site-level dir is. It also prefers the
# checked-out version of an app over the standard python install locations.
sys.path.append(PROJ_ROOT)
ADMINS = (
# ('NASA Intelligent Robotics Group', '[email protected]'),
)
MANAGERS = ADMINS
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# If running in a Windows environment this must be set to the same as your
# system time zone.
TIME_ZONE = 'America/Los_Angeles'
# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-US'
SITE_ID = 1 # This is for Django's site framework - NOT to specify the location of a field site.
# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True
# Absolute path to the directory that holds static.
# Example: "/home/static/static.lawrence.com/"
STATIC_ROOT = os.path.join(PROJ_ROOT, "build", "static")
# URL that handles the static served from STATIC_ROOT. Make sure to use a
# trailing slash if there is a path component (optional in other cases).
# Examples: "http://static.lawrence.com", "http://example.com/static/"
STATIC_URL = SCRIPT_NAME + 'static/'
EXTERNAL_URL = STATIC_URL
# Absolute path to the directory that holds data. This is different than static
# in that it's uploaded/processed data that's not needed for the operation of
# the site, but may need to be network-accessible, or be linked to from the
# database. Examples: images, generate kml files, etc.
# Example: "/data"
DATA_ROOT = os.path.join(PROJ_ROOT, 'data', '')
# URL that handles the data served from DATA_ROOT. Make sure to use a
# trailing slash if there is a path component (optional in other cases).
# Examples: "http://data.lawrence.com", "http://example.com/data/"
DATA_URL = SCRIPT_NAME + 'data/'
# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
MEDIA_ROOT = DATA_ROOT
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash if there is a path component (optional in other cases).
# Examples: "http://media.lawrence.com", "http://example.com/media/"
MEDIA_URL = DATA_URL
# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
# trailing slash.
# Examples: "http://foo.com/media/", "/media/".
ADMIN_MEDIA_PREFIX = '/static/admin/'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
os.path.join(PROJ_ROOT, 'apps', XGDS_SITE_APP, 'templates'),
os.path.join(PROJ_ROOT, 'apps', XGDS_SITE_APP, 'templates', XGDS_SITE_APP),
os.path.join(PROJ_ROOT, 'apps/xgds_core/templates/registration'),
# Templates for utility scripts
os.path.join(PROJ_ROOT, 'bin/templates'),
],
'APP_DIRS': True,
'OPTIONS': {
'debug': True,
'context_processors': ['django.template.context_processors.request',
'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.static',
'django.template.context_processors.tz',
'django.contrib.messages.context_processors.messages',
'geocamUtil.context_processors.settings',
'geocamUtil.context_processors.AuthUrlsContextProcessor.AuthUrlsContextProcessor',
'geocamUtil.context_processors.SettingsContextProcessor.SettingsContextProcessor'
],
},
},
]
# Session Serializer: we use Pickle for backward compatibility and to allow more flexible session storage, but
# be sure to keep the SECRET_KEY secret for security (see:
# https://docs.djangoproject.com/en/1.7/topics/http/sessions/#session-serialization)
SESSION_SERIALIZER = 'django.contrib.sessions.serializers.PickleSerializer'
# List of callables that know how to import templates from various sources.
# TEMPLATE_LOADERS = ('django.template.loaders.filesystem.Loader',
# 'django.template.loaders.app_directories.Loader',
# # 'django.template.loaders.eggs.load_template_source',
# )
MIDDLEWARE_CLASSES = (
'geocamUtil.middleware.LogErrorsMiddleware',
'django.middleware.gzip.GZipMiddleware',
'corsheaders.middleware.CorsMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.RemoteUserMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
)
AUTHENTICATION_BACKENDS = [
'django.contrib.auth.backends.RemoteUserBackend',
'django.contrib.auth.backends.ModelBackend'
]
ROOT_URLCONF = 'urls'
#TODO probably can delete the below 2 lines
LOGIN_URL = SCRIPT_NAME + 'accounts/login/'
LOGIN_REDIRECT_URL = '/'
# email settings
EMAIL_BACKEND = 'django.core.mail.backends.filebased.EmailBackend'
EMAIL_FILE_PATH = '/tmp/xgds_messages'
EMAIL_SUBJECT_PREFIX = '[xGDS] '
SERVER_EMAIL = '[email protected]'
# MANAGERS = (
# # Addresses listed here will get notification when a new user requests an account
# ('First Last', '[email protected]'),
# )
STATICFILES_STORAGE = 'pipeline.storage.PipelineCachedStorage'
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'pipeline.finders.FileSystemFinder',
'pipeline.finders.AppDirectoriesFinder',
'pipeline.finders.PipelineFinder',
'pipeline.finders.CachedFileFinder',
'djangobower.finders.BowerFinder',
'django_npm_apps.finders.NpmAppFinder',
)
# SET UP PIPELINE
PIPELINE = getOrCreateDict('PIPELINE')
# PIPELINE['JAVASCRIPT'] = {'custom_map': {'source_filenames': ('xgds_demo_app/js/showMapCoords.js',
# 'xgds_demo_app/js/initial_layers.js',),
# 'output_filename': 'js/custom_map.js',
# }
# }
PIPELINE['CSS_COMPRESSOR'] = 'pipeline.compressors.yuglify.YuglifyCompressor'
PIPELINE['PIPELINE_ENABLED'] = True
PIPELINE['JS_COMPRESSOR'] = 'pipeline.compressors.yuglify.YuglifyCompressor'
PIPELINE['CSS_COMPRESSOR'] = 'pipeline.compressors.yuglify.YuglifyCompressor'
PIPELINE['YUGLIFY_JS_ARGUMENTS'] = 'mangle:false --terminal'
PIPELINE['DISABLE_WRAPPER'] = True
COMPRESS_ENABLED = False
#COMPRESS_CSSTIDY_BINARY = '/usr/bin/csstidy'
# PIPELINE_COMPILERS = ()
DEBUG_TOOLBAR = False
if DEBUG_TOOLBAR:
INSTALLED_APPS += ('debug_toolbar',)
MIDDLEWARE_CLASSES_LIST = list(MIDDLEWARE_CLASSES)
MIDDLEWARE_CLASSES_LIST.insert(2, 'debug_toolbar.middleware.DebugToolbarMiddleware')
MIDDLEWARE_CLASSES = tuple(MIDDLEWARE_CLASSES_LIST)
INTERNAL_IPS = ('127.0.0.1',
'10.0.3.1',
'::1') # TODO add your virtual machine's IP here from your host;
#ie do an ifconfig and see if virtualbox or vmware has created something.
# Alternately you can create a view that returns request.META['REMOTE_ADDR']
DEBUG_TOOLBAR_PANELS = ['debug_toolbar.panels.versions.VersionsPanel',
'debug_toolbar.panels.timer.TimerPanel',
'debug_toolbar.panels.settings.SettingsPanel',
'debug_toolbar.panels.headers.HeadersPanel',
'debug_toolbar.panels.request.RequestPanel',
'debug_toolbar.panels.sql.SQLPanel',
'debug_toolbar.panels.staticfiles.StaticFilesPanel',
'debug_toolbar.panels.templates.TemplatesPanel',
'debug_toolbar.panels.cache.CachePanel',
'debug_toolbar.panels.signals.SignalsPanel',
'debug_toolbar.panels.logging.LoggingPanel',
'debug_toolbar.panels.redirects.RedirectsPanel',
#'debug_toolbar.panels.profiling.ProfilingPanel',
]
DEBUG_TOOLBAR_CONFIG = {'INTERCEPT_REDIRECTS': False,
'RENDER_PANELS': True,
'JQUERY_URL': '',
}
VAR_ROOT = PROJ_ROOT + 'var/'
GEOCAM_TRACK_OPS_TIME_ZONE = TIME_ZONE
COMPASS_EQUIPPED_VEHICLES = []
# FOR HI IT IS
COMPASS_CORRECTION = 10
# Update this if you are using xgds_sample, to put a permanent link in the qr codes to a url.
# XGDS_SAMPLE_PERM_LINK_PREFIX = "https://myapp.xgds.org"
# XGDS_INSTRUMENT_IMPORT_MODULE_PATH = 'xgds_baseline_app.instrumentDataImporters'
# GEOCAM_TRACK_RECENT_TIME_FUNCTION = 'xgds_baseline_app.views.getCurrentTimeWithDelayCorrection'
# XGDS_VIDEO_GET_ACTIVE_EPISODE = 'xgds_baseline_app.views.getActiveEpisode'
# XGDS_VIDEO_GET_EPISODE_FROM_NAME = 'xgds_baseline_app.views.getEpisodeFromName'
# XGDS_VIDEO_GET_TIMEZONE_FROM_NAME = 'xgds_baseline_app.views.getTimezoneFromFlightName'
# XGDS_VIDEO_INDEX_FILE_METHOD = 'xgds_baseline_app.views.getIndexFileSuffix'
# XGDS_VIDEO_DELAY_AMOUNT_METHOD = 'xgds_baseline_app.views.getDelaySeconds'
# XGDS_VIDEO_NOTE_EXTRAS_FUNCTION = 'xgds_baseline_app.views.getNoteExtras'
# XGDS_VIDEO_NOTE_FILTER_FUNCTION = 'xgds_baseline_app.views.noteFilterFunction'
# RECORDED_VIDEO_DIR_BASE = DATA_ROOT
# RECORDED_VIDEO_URL_BASE = DATA_URL
PYRAPTORD_SERVICE = True
XGDS_CURRENT_SITEFRAME_ID = 1 # Set this to your siteframe; this will probably be NASA Ames
#XGDS_MAP_SERVER_DEFAULT_ZOOM = 6
XGDS_CORE_LIVE_INDEX_URL = '/' + XGDS_SITE_APP + '/live'
TEST_RUNNER = 'django.test.runner.DiscoverRunner'
def make_key(key, key_prefix, version):
return key
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'LOCATION': '127.0.0.1:11211',
'TIMEOUT': 604800,
'KEY_FUNCTION' : make_key
}
}
# FILE_UPLOAD_TEMP_DIR = os.path.join(DATA_ROOT, XGDS_MAP_SERVER_GEOTIFF_SUBDIR, 'temp')
#ZEROMQ_PORTS = PROJ_ROOT + 'apps/xgds_baseline_app/ports.json'
# XGDS_MAP_SERVER_MAP_LOADED_CALLBACK = 'rp.coordinator.init'
# XGDS_MAP_SERVER_MAP_SETUP_COORD_SYSTEM = 'rp.coordinator.setupCoordinateSystem'
# #south pole
# #XGDS_MAP_SERVER_DEFAULT_COORD_SYSTEM = 'IAU2000:30120'
# #XGDS_MAP_SERVER_DEFAULT_COORD_SYSTEM_CENTER = [-26709, 102815]
# #north pole
# XGDS_MAP_SERVER_DEFAULT_COORD_SYSTEM = 'IAU2000:30118'
# XGDS_MAP_SERVER_DEFAULT_COORD_SYSTEM_CENTER = [47086.5, -78921.5]
# XGDS_MAP_SERVER_BODY_RADIUS_METERS = 1737400
# XGDS_MAP_SERVER_GDAL2TILES_EXTRAS = "-p raster "
# XGDS_MAP_SERVER_GDAL2TILES_ZOOM_LEVELS = False
USE_TZ = True
# turn this on when we are live field broadcasting
GEOCAM_UTIL_LIVE_MODE = False
GEOCAM_UTIL_DATATABLES_EDITOR = False
GEOCAM_TRACK_URL_PORT = 8181
# While you are modifying handlebars templates, this should be true. Once they have been loaded
# once they will be cached and you can set this to false.
XGDS_CORE_TEMPLATE_DEBUG = True
JWPLAYER_KEY = '***REMOVED***'
ALLOWED_HOSTS = ['*']
# Setup support for proxy headers
USE_X_FORWARDED_HOST = True
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': (
'rest_framework.authentication.BasicAuthentication',
'rest_framework.authentication.SessionAuthentication',
'rest_framework.authentication.TokenAuthentication',
),
'DEFAULT_PERMISSION_CLASSES': [
'rest_framework.permissions.IsAuthenticated',
]
}
SESSION_EXPIRE_AT_BROWSER_CLOSE = True
SESSION_COOKIE_AGE = 43200 # 12 hours
COUCHDB_FILESTORE_NAME = "demo-file-store"