-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlocal_settings.py.tmpl
321 lines (273 loc) · 9.78 KB
/
local_settings.py.tmpl
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
import os
from geonode.settings import TEMPLATES, INSTALLED_APPS
import geonode.settings
import openquakeplatform
DEBUG = True
TIME_ZONE = 'UTC'
PROJECT_ROOT = os.path.abspath(os.path.dirname(geonode.__file__))
OQPLATFORM_ROOT = os.path.dirname(openquakeplatform.__file__)
SITEURL = 'http://%(lxc_ip)s'
SITENAME = 'OpenQuake Platform'
ALLOWED_HOSTS = ['%(lxc_ip)s', 'localhost']
PROXY_ALLOWED_HOSTS = ('%(lxc_ip)s', 'localhost')
PROXY_BASE_URL = '%(lxc_ip)s/geoserver'
AUTH_IP_WHITELIST = ['%(lxc_ip)s']
GOOGLE_UA = 'xxx'
WEBUIURL = 'http://%(webuiurl)s/'
FILE_PATH_FIELD_DIRECTORY = '%(datadir)s/'
ROOT_URLCONF = 'openquakeplatform.urls'
GEM_ISC_MAP_UUID = 'ee8019c0-5a77-11e8-af87-00163ec54f0a'
GEM_GHEC_MAP_UUID = '6a6737e4-6252-11e8-ae52-e2db80e0bfca'
GEM_ACTFAU_MAP_UUID = '6a6737e4-6252-11e8-ae52-e2db80e0bfca'
GEM_STRRAT_MAP_UUID = '6a6737e4-6252-11e8-ae52-e2db80e0bfca'
THIRD_PARTY_URLS = {
'leaflet_base_map': (
'http://{s}.tiles.mapbox.com/v3/unhcr.map-8bkai3wa/{z}/{x}/{y}.png'
),
}
TILESTREAM_URL = '//tilestream.openquake.org'
SECRET_KEY = '%(secret)s'
DATABASES = {
'default': {
'ENGINE': 'django.contrib.gis.db.backends.postgis',
'NAME': '%(db_name)s',
'USER': '%(db_user)s',
'PASSWORD': '%(db_pass)s',
'HOST': 'localhost',
'PORT': '5432',
},
# vector datastore for uploads
'datastore': {
'ENGINE': 'django.contrib.gis.db.backends.postgis',
# 'ENGINE': '', # Empty ENGINE name disables
'NAME': '%(db_user)s-imports',
'USER': '%(db_user)s',
'PASSWORD': '%(db_pass)s',
'HOST': 'localhost',
'PORT': '5432',
}
}
# Search Snippet Cache Time in Seconds
CACHE_TIME = int(os.getenv('CACHE_TIME', '0'))
GEOSERVER_LOCATION = 'http://%(geo_ip)s/geoserver/'
GEOSERVER_PUBLIC_LOCATION = 'http://%(geo_public_ip)s/geoserver/'
OGC_SERVER_DEFAULT_USER = 'admin'
OGC_SERVER_DEFAULT_PASSWORD = 'geoserver'
# OGC (WMS/WFS/WCS) Server Settings
OGC_SERVER = {
'default': {
'BACKEND': 'geonode.geoserver',
'LOCATION': GEOSERVER_LOCATION,
'LOGIN_ENDPOINT': 'j_spring_oauth2_geonode_login',
'LOGOUT_ENDPOINT': 'j_spring_oauth2_geonode_logout',
# PUBLIC_LOCATION needs to be kept like this because in dev mode
# the proxy won't work and the integration tests will fail
# the entire block has to be overridden in the local_settings
'PUBLIC_LOCATION': GEOSERVER_PUBLIC_LOCATION,
'USER': OGC_SERVER_DEFAULT_USER,
'PASSWORD': OGC_SERVER_DEFAULT_PASSWORD,
'MAPFISH_PRINT_ENABLED': True,
'PRINT_NG_ENABLED': True,
'GEONODE_SECURITY_ENABLED': True,
'GEOGIG_ENABLED': False,
'WMST_ENABLED': False,
'BACKEND_WRITE_ENABLED': True,
'WPS_ENABLED': False,
'LOG_FILE': '%%s/geoserver/data/logs/geoserver.log' %% os.path.abspath(os.path.join(PROJECT_ROOT, os.pardir)),
# Set to dictionary identifier of database
# containing spatial data in DATABASES dictionary to enable
'DATASTORE': 'datastore', #'datastore',
'PG_GEOGIG': False,
'TIMEOUT': 10 # number of seconds to allow for HTTP requests
}
}
CATALOGUE = {
'default': {
# The underlying CSW backend
# ("pycsw_http", "pycsw_local", "geonetwork", "deegree")
'ENGINE': 'geonode.catalogue.backends.pycsw_local',
# The FULLY QUALIFIED base url to the CSW instance for this GeoNode
'URL': 'http://%(lxc_ip)s/catalogue/csw',
}
}
# Additional directories which hold static files
STATICFILES_DIRS = [
os.path.join(OQPLATFORM_ROOT, 'static'),
os.path.join(PROJECT_ROOT, 'static'),
]
TEMPLATES[0]['DIRS'].insert(0, os.path.join(OQPLATFORM_ROOT, 'templates'))
TEMPLATES[0]['OPTIONS']['context_processors'].append(
'openquakeplatform.utils.oq_context_processor')
# for django-request
TEMPLATES[0]['OPTIONS']['context_processors'].append(
'django.core.context_processors.request')
ALLOWED_DOCUMENT_TYPES = [
'csv', 'doc', 'docx', 'xls', 'xlsx', 'odt', 'ods', 'pdf',
'jpg', 'jpeg', 'tif', 'tiff', 'png', 'gif', 'txt', 'zip',
'tar', 'tgz', 'tbz', 'tar.gz', 'tar.bz2'
]
MAX_DOCUMENT_SIZE = 100
STANDALONE_APPS = (
'openquakeplatform_ipt',
'openquakeplatform_taxtweb',
'openquakeplatform_building_class',
)
inst_new = tuple(['corsheaders'])
for app in INSTALLED_APPS:
if app == 'django.contrib.admin':
inst_new += ('nested_inlines', app)
else:
inst_new += (app, )
INSTALLED_APPS = inst_new
INSTALLED_APPS += (
'django.contrib.redirects',
'request',
'nested_inline',
'chained_multi_checkboxes',
'chained_selectbox',
) + STANDALONE_APPS + (
'openquakeplatform.vulnerability',
'openquakeplatform.grv',
# on old platform is not working, it needs effort
# to be fixed, temporarly disabled
# 'openquakeplatform.geodetic',
'openquakeplatform.irv',
'openquakeplatform.world',
'openquakeplatform.svir',
'openquakeplatform.ghec_viewer',
'openquakeplatform.isc_viewer',
'openquakeplatform.pla_common',
'openquakeplatform.monitoring',
)
MIDDLEWARE_CLASSES = (
'corsheaders.middleware.CorsMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.contrib.redirects.middleware.RedirectFallbackMiddleware',
'pagination.middleware.PaginationMiddleware',
# irv needs csrf to be disabled to work
# 'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
# geonode.security is enabled to lockdown the website
'geonode.security.middleware.LoginRequiredMiddleware',
# If you use SessionAuthenticationMiddleware,
# be sure it appears before OAuth2TokenMiddleware.
# SessionAuthenticationMiddleware
# is NOT required for using django-oauth-toolkit.
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'oauth2_provider.middleware.OAuth2TokenMiddleware',
# django-request
'request.middleware.RequestMiddleware',
)
# Add additional paths (as regular expressions) that don't require
# authentication.
AUTH_EXEMPT_URLS = ('/$',
'/account/signup/',
'/calculate/',
'/share/',
'/explore/',
'/about/',
'/monitoring/',
'/geoserver/',
'/gs/.*',
'/maps/',
'/api/layers/.*',
'/api/maps/.*',
'/api/users/.*',
'/api/roles/.*',
'/proxy/',
'/uploaded/thumbs/',
'/vulnerability',
'/vulnerability/intensity_measure_csc?.*',
'/vulnerability/engineering_demand_csc?.*',
'/vulnerability/resp_var_par_csc?.*',
'/vulnerability/resp_var_units_csc?.*',
'/taxtweb/',
'/building-class/')
# replacement of default authentication backend in order to support
# permissions per object.
AUTHENTICATION_BACKENDS = (
'oauth2_provider.backends.OAuth2Backend',
'django.contrib.auth.backends.ModelBackend',
'guardian.backends.ObjectPermissionBackend',
)
OAUTH2_PROVIDER = {
'SCOPES': {
'read': 'Read scope',
'write': 'Write scope',
'groups': 'Access to your groups'
},
'CLIENT_ID_GENERATOR_CLASS':
'oauth2_provider.generators.ClientIdGenerator',
}
# Absolute filesystem path to the directory
# that will be used to upload/download schema.xsd files through gsschema app
GSSCHEMA_CONFIG = {
'gsschema_dir': '/var/lib/geoserver_data/'
}
# where to save tilebundler tilesets. Should move this to OGC_SERVER['default']['TILEBUNDLER_DATASTORE_DIR']
TILEBUNDLER_CONFIG = {
'tileset_dir': '/var/lib/geoserver_data/tilebundler-store'
}
MAP_BASELAYERS = [
{
"source": {
"ptype": "gxp_wmscsource",
"url": OGC_SERVER['default']['LOCATION'] + "wms",
"restUrl": "/gs/rest",
"name": "local geoserver"
}
},
{
"source": {"ptype": "gxp_tilestreamsource" },
"name":"tilestream"
},
{
"source": {"ptype": "gxp_osmsource", "name": "OpenStreetMap"},
"type": "OpenLayers.Layer.OSM",
"name": "mapnik",
"title": "OpenStreetMap",
"args": ["OpenStreetMap"],
"visibility": True,
"fixed": True,
"group":"background"
}
]
# Uncomment to allow open registration.
# NOTE: there's no admin validation on new accounts.
REGISTRATION_OPEN = True
# Uncomment to allow open registration.
# This setting define in how many days an account
# must be verified by the user.
ACCOUNT_ACTIVATION_DAYS = 1
ACCOUNT_EMAIL_CONFIRMATION_EMAIL = True
# Define email service on GeoNode
EMAIL_ENABLE = True
if EMAIL_ENABLE:
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'xxx.xx.xx.xx'
EMAIL_PORT = 25
DEFAULT_FROM_EMAIL = '[email protected]'
THEME_ACCOUNT_CONTACT_EMAIL = '[email protected]'
FILESERVICE_CONFIG = {
'store_dir': '/var/lib/geoserver_data/file-service-store',
# example: ('*', ) or ('.mov', '.jpg', ...),
'types_allowed': ('*', ),
'url_template': '/api/fileservice/view/{}'
}
# These limits define the maximum data that can be retreived
# from GEM in the Exposure app
# Max area size in degrees (i.e. 2 * 2)
EXPOSURE_MAX_EXPORT_AREA_SQ_DEG = 4
# Max number of rows
EXPOSURE_MAX_TOT_GRID_COUNT = 100000
TIME_INVARIANT_OUTPUTS = False
REQUEST_IGNORE_IP = ['127.0.0.1']
REQUEST_IGNORE_PATHS = (
r'^admin/',
)
CORS_ORIGIN_ALLOW_ALL = True
CORS_URLS_REGEX = r'^/taxtweb/explanation/'
CORS_ALLOW_CREDENTIAL = False