-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsettings.py
More file actions
598 lines (513 loc) · 17 KB
/
settings.py
File metadata and controls
598 lines (513 loc) · 17 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
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
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2012 OpenPlans
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#########################################################################
# Django settings for the GeoNode project.
import os
#
# General Django development settings
#
# Defines the directory that contains the settings file as the PROJECT_ROOT
# It is used for relative settings elsewhere.
PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))
# Setting debug to true makes Django serve static media and
# present pretty error pages.
DEBUG = TEMPLATE_DEBUG = True
# Set to True to load non-minified versions of (static) client dependencies
DEBUG_STATIC = False
# This is needed for integration tests, they require
# geonode to be listening for GeoServer auth requests.
os.environ['DJANGO_LIVE_TEST_SERVER_ADDRESS'] = 'localhost:8000'
# Defines settings for development
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(PROJECT_ROOT, 'development.db'),
},
# vector datastore for uploads
#'datastore' : {
# 'ENGINE': 'django.contrib.gis.db.backends.postgis',
# 'NAME': '',
# 'USER' : '',
# 'PASSWORD' : '',
# 'HOST' : '',
# 'PORT' : '',
#}
}
# 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/Chicago'
# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en'
LANGUAGES = (
('en', 'English'),
('es', 'Español'),
('it', 'Italiano'),
('fr', 'Français'),
('de', 'Deutsch'),
('el', 'Ελληνικά'),
('id', 'Bahasa Indonesia'),
('zh-cn', '中文'),
('ja', '日本人'),
('fa', 'Persian'),
('pt', 'Portuguese'),
('ru', 'Russian'),
('vi', 'Vietnamese'),
#('fil', 'Filipino'),
)
# 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 media.
# Example: "/home/media/media.lawrence.com/"
MEDIA_ROOT = os.path.join(PROJECT_ROOT, "uploaded")
# 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 = "/uploaded/"
# Absolute path to the directory that holds static files like app media.
# Example: "/home/media/media.lawrence.com/apps/"
STATIC_ROOT = os.path.join(PROJECT_ROOT, "static_root")
# URL that handles the static files like app media.
# Example: "http://media.lawrence.com"
STATIC_URL = "/static/"
# Additional directories which hold static files
STATICFILES_DIRS = [
os.path.join(PROJECT_ROOT, "static"),
]
# 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',
)
# Note that Django automatically includes the "templates" dir in all the
# INSTALLED_APPS, se there is no need to add maps/templates or admin/templates
TEMPLATE_DIRS = (
os.path.join(PROJECT_ROOT, "templates"),
)
# Location of translation files
LOCALE_PATHS = (
os.path.join(PROJECT_ROOT, "locale"),
)
# Make this unique, and don't share it with anybody.
SECRET_KEY = 'myv-y4#7j-d*p-__@j#*3z@!y24fz8%^z2v6atuy4bo9vqr1_a'
# Location of url mappings
ROOT_URLCONF = 'geonode.urls'
# Site id in the Django sites framework
SITE_ID = 1
# Login and logout urls override
LOGIN_URL = '/account/login/'
LOGOUT_URL = '/account/logout/'
# Activate the Documents application
DOCUMENTS_APP = True
ALLOWED_DOCUMENT_TYPES = [
'doc', 'docx','gif', 'jpg', 'jpeg', 'ods', 'odt', 'pdf', 'png', 'ppt',
'rar', 'tif', 'tiff', 'txt', 'xls', 'xlsx', 'xml', 'zip',
]
MAX_DOCUMENT_SIZE = 2 # MB
INSTALLED_APPS = (
# Apps bundled with Django
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.admin',
'django.contrib.sitemaps',
'django.contrib.staticfiles',
'django.contrib.messages',
'django.contrib.humanize',
# Third party apps
# Utility
'pagination',
'taggit',
'taggit_templatetags',
'south',
'friendlytagloader',
'geoexplorer',
'django_extensions',
# Theme
"pinax_theme_bootstrap_account",
"pinax_theme_bootstrap",
'django_forms_bootstrap',
# Social
'account',
'avatar',
'dialogos',
'agon_ratings',
'notification',
'announcements',
'actstream',
'user_messages',
# GeoNode internal apps
'geonode.people',
'geonode.base',
'geonode.layers',
'geonode.upload',
'geonode.maps',
'geonode.proxy',
'geonode.security',
'geonode.search',
'geonode.social',
'geonode.catalogue',
'geonode.documents',
)
LOGGING = {
'version': 1,
'disable_existing_loggers': True,
'formatters': {
'verbose': {
'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
},
'simple': {
'format': '%(message)s', },
},
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
}
},
'handlers': {
'null': {
'level':'ERROR',
'class':'django.utils.log.NullHandler',
},
'console':{
'level':'ERROR',
'class':'logging.StreamHandler',
'formatter': 'simple'
},
'mail_admins': {
'level': 'ERROR',
'filters': ['require_debug_false'],
'class': 'django.utils.log.AdminEmailHandler',
}
},
"loggers": {
"django": {
"handlers": ["console"],
"level": "ERROR",
},
"geonode": {
"handlers": ["console"],
"level": "ERROR",
},
"gsconfig.catalog": {
"handlers": ["console"],
"level": "ERROR",
},
"owslib": {
"handlers": ["console"],
"level": "ERROR",
},
"pycsw": {
"handlers": ["console"],
"level": "ERROR",
},
'south': {
"handlers": ["console"],
"level": "ERROR",
},
},
}
#
# Customizations to built in Django settings required by GeoNode
#
TEMPLATE_CONTEXT_PROCESSORS = (
'django.contrib.auth.context_processors.auth',
'django.core.context_processors.debug',
'django.core.context_processors.i18n',
"django.core.context_processors.tz",
'django.core.context_processors.media',
"django.core.context_processors.static",
'django.core.context_processors.request',
'django.contrib.messages.context_processors.messages',
'account.context_processors.account',
'pinax_theme_bootstrap_account.context_processors.theme',
# The context processor below adds things like SITEURL
# and GEOSERVER_BASE_URL to all pages that use a RequestContext
'geonode.context_processors.resource_urls',
)
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
# The setting below makes it possible to serve different languages per
# user depending on things like headers in HTTP requests.
'django.middleware.locale.LocaleMiddleware',
'pagination.middleware.PaginationMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
# This middleware allows to print private layers for the users that have
# the permissions to view them.
# It sets temporary the involved layers as public before restoring the permissions.
# Beware that for few seconds the involved layers are public there could be risks.
#'geonode.middleware.PrintProxyMiddleware',
)
# Replacement of default authentication backend in order to support
# permissions per object.
AUTHENTICATION_BACKENDS = ('geonode.security.auth.GranularBackend',)
def get_user_url(u):
return u.profile.get_absolute_url()
ABSOLUTE_URL_OVERRIDES = {
'auth.user': get_user_url
}
# Redirects to home page after login
# FIXME(Ariel): I do not know why this setting is needed,
# it would be best to use the ?next= parameter
LOGIN_REDIRECT_URL = "/"
#
# Settings for default search size
#
DEFAULT_SEARCH_SIZE = 10
#
# Settings for third party apps
#
# Agon Ratings
AGON_RATINGS_CATEGORY_CHOICES = {
"maps.Map": {
"map": "How good is this map?"
},
"layers.Layer": {
"layer": "How good is this layer?"
},
"documents.Document": {
"document": "How good is this document?"
}
}
# Activity Stream
ACTSTREAM_SETTINGS = {
'MODELS': ('auth.user', 'layers.layer', 'maps.map', 'dialogos.comment', 'documents.document'),
'FETCH_RELATIONS': True,
'USE_PREFETCH': False,
'USE_JSONFIELD': True,
'GFK_FETCH_DEPTH': 1,
}
# For South migrations
SOUTH_MIGRATION_MODULES = {
'avatar': 'geonode.migrations.avatar',
}
SOUTH_TESTS_MIGRATE=False
# Settings for Social Apps
AUTH_PROFILE_MODULE = 'people.Profile'
REGISTRATION_OPEN = False
# Email for users to contact admins.
THEME_ACCOUNT_CONTACT_EMAIL = 'admin@example.com'
#
# Test Settings
#
# Setting a custom test runner to avoid running the tests for
# some problematic 3rd party apps
TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
# Arguments for the test runner
NOSE_ARGS = [
'--nocapture',
'--detailed-errors',
]
#
# GeoNode specific settings
#
SITEURL = "http://localhost:8000/"
# Default TopicCategory to be used for resources. Use the slug field here
DEFAULT_TOPICCATEGORY = 'location'
# Topic Categories list should not be modified (they are ISO). In case you
# absolutely need it set to True this variable
MODIFY_TOPICCATEGORY = False
MISSING_THUMBNAIL = 'geonode/img/missing_thumb.png'
# Search Snippet Cache Time in Seconds
CACHE_TIME=0
# OGC (WMS/WFS/WCS) Server Settings
OGC_SERVER = {
'default' : {
'BACKEND' : 'geonode.geoserver',
'LOCATION' : 'http://localhost:8080/geoserver/',
# 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' : 'http://localhost:8080/geoserver/',
'USER' : 'admin',
'PASSWORD' : 'geoserver',
'MAPFISH_PRINT_ENABLED' : True,
'PRINTNG_ENABLED' : True,
'GEONODE_SECURITY_ENABLED' : True,
'GEOGIT_ENABLED' : False,
'WMST_ENABLED' : False,
'BACKEND_WRITE_ENABLED': True,
'WPS_ENABLED' : True,
# Set to name of database in DATABASES dictionary to enable
'DATASTORE': '', #'datastore',
'TIMEOUT': 10 # number of seconds to allow for HTTP requests
}
}
# Uploader Settings
UPLOADER = {
'BACKEND' : 'geonode.rest',
'OPTIONS' : {
'TIME_ENABLED': False,
'GEOGIT_ENABLED': False,
}
}
# CSW settings
CATALOGUE = {
'default': {
# The underlying CSW implementation
# default is pycsw in local mode (tied directly to GeoNode Django DB)
'ENGINE': 'geonode.catalogue.backends.pycsw_local',
# pycsw in non-local mode
#'ENGINE': 'geonode.catalogue.backends.pycsw_http',
# GeoNetwork opensource
#'ENGINE': 'geonode.catalogue.backends.geonetwork',
# deegree and others
#'ENGINE': 'geonode.catalogue.backends.generic',
# The FULLY QUALIFIED base url to the CSW instance for this GeoNode
'URL': '%scatalogue/csw' % SITEURL,
#'URL': 'http://localhost:8080/geonetwork/srv/en/csw',
#'URL': 'http://localhost:8080/deegree-csw-demo-3.0.4/services',
# login credentials (for GeoNetwork)
'USER': 'admin',
'PASSWORD': 'admin',
}
}
# pycsw settings
PYCSW = {
# pycsw configuration
'CONFIGURATION': {
'metadata:main': {
'identification_title': 'GeoNode Catalogue',
'identification_abstract': 'GeoNode is an open source platform that facilitates the creation, sharing, and collaborative use of geospatial data',
'identification_keywords': 'sdi,catalogue,discovery,metadata,GeoNode',
'identification_keywords_type': 'theme',
'identification_fees': 'None',
'identification_accessconstraints': 'None',
'provider_name': 'Organization Name',
'provider_url': SITEURL,
'contact_name': 'Lastname, Firstname',
'contact_position': 'Position Title',
'contact_address': 'Mailing Address',
'contact_city': 'City',
'contact_stateorprovince': 'Administrative Area',
'contact_postalcode': 'Zip or Postal Code',
'contact_country': 'Country',
'contact_phone': '+xx-xxx-xxx-xxxx',
'contact_fax': '+xx-xxx-xxx-xxxx',
'contact_email': 'Email Address',
'contact_url': 'Contact URL',
'contact_hours': 'Hours of Service',
'contact_instructions': 'During hours of service. Off on weekends.',
'contact_role': 'pointOfContact',
},
'metadata:inspire': {
'enabled': 'true',
'languages_supported': 'eng,gre',
'default_language': 'eng',
'date': 'YYYY-MM-DD',
'gemet_keywords': 'Utility and governmental services',
'conformity_service': 'notEvaluated',
'contact_name': 'Organization Name',
'contact_email': 'Email Address',
'temp_extent': 'YYYY-MM-DD/YYYY-MM-DD',
}
}
}
# GeoNode javascript client configuration
# Where should newly created maps be focused?
DEFAULT_MAP_CENTER = (0, 0)
# How tightly zoomed should newly created maps be?
# 0 = entire world;
# maximum zoom is between 12 and 15 (for Google Maps, coverage varies by area)
DEFAULT_MAP_ZOOM = 0
MAP_BASELAYERS = [{
"source": {
"ptype": "gxp_wmscsource",
"url": OGC_SERVER['default']['PUBLIC_LOCATION'] + "wms",
"restUrl": "/gs/rest"
}
},{
"source": {"ptype": "gxp_olsource"},
"type":"OpenLayers.Layer",
"args":["No background"],
"visibility": False,
"fixed": True,
"group":"background"
}, {
"source": {"ptype": "gxp_osmsource"},
"type":"OpenLayers.Layer.OSM",
"name":"mapnik",
"visibility": False,
"fixed": True,
"group":"background"
}, {
"source": {"ptype": "gxp_mapquestsource"},
"name":"osm",
"group":"background",
"visibility": True
}, {
"source": {"ptype": "gxp_mapquestsource"},
"name":"naip",
"group":"background",
"visibility": False
}, {
"source": {"ptype": "gxp_bingsource"},
"name": "AerialWithLabels",
"fixed": True,
"visibility": False,
"group":"background"
},{
"source": {"ptype": "gxp_mapboxsource"},
}, {
"source": {"ptype": "gxp_olsource"},
"type":"OpenLayers.Layer.WMS",
"group":"background",
"visibility": False,
"fixed": True,
"args":[
"bluemarble",
"http://maps.opengeo.org/geowebcache/service/wms",
{
"layers":["bluemarble"],
"format":"image/png",
"tiled": True,
"tilesOrigin": [-20037508.34, -20037508.34]
},
{"buffer": 0}
]
}]
LEAFLET_CONFIG = {
'TILES_URL': 'http://{s}.tile2.opencyclemap.org/transport/{z}/{x}/{y}.png'
}
SOCIAL_BUTTONS = True
# Require users to authenticate before using Geonode
LOCKDOWN_GEONODE = False
# Add additional paths (as regular expressions) that don't require authentication.
AUTH_EXEMPT_URLS = ()
if LOCKDOWN_GEONODE:
MIDDLEWARE_CLASSES = MIDDLEWARE_CLASSES + ('geonode.security.middleware.LoginRequiredMiddleware',)
# A tuple of hosts the proxy can send requests to.
PROXY_ALLOWED_HOSTS = ()
# The proxy to use when making cross origin requests.
PROXY_URL = '/proxy/?url='
# Load more settings from a file called local_settings.py if it exists
try:
from local_settings import *
except ImportError:
pass