Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
139 lines (118 sloc) 4.71 KB
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2016 OSGeo
#
# 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/>.
#
#########################################################################
""" There are 3 ways to override GeoNode settings:
1. Using environment variables, if your changes to GeoNode are minimal.
2. Creating a downstream project, if you are doing a lot of customization.
3. Override settings in a local_settings.py file, legacy.
"""
# flake8: noqa
# Disable flake8 check, since this is just a custom settings file
import os
try:
# import geonode settings
from geonode.settings import *
except ImportError:
pass
qgis_server_apps_package = "geonode.qgis_server"
GEONODE_APPS = list(GEONODE_APPS)
if qgis_server_apps_package not in GEONODE_APPS:
GEONODE_APPS += ("geonode.qgis_server", )
INSTALLED_APPS = list(INSTALLED_APPS)
if qgis_server_apps_package not in INSTALLED_APPS:
INSTALLED_APPS += ("geonode.qgis_server", )
# QGIS Server Backend settings
# Delete Geoserver settings
USE_GEOSERVER = False
if 'geonode.geoserver' in INSTALLED_APPS:
INSTALLED_APPS.remove("geonode.geoserver")
if 'geonode.geoserver' in GEONODE_APPS:
GEONODE_APPS.remove("geonode.geoserver")
if 'PUBLIC_GEOSERVER' in locals() and \
PUBLIC_GEOSERVER in MAP_BASELAYERS:
MAP_BASELAYERS.remove(PUBLIC_GEOSERVER)
del PUBLIC_GEOSERVER
if 'LOCAL_GEOSERVER' in locals() and \
LOCAL_GEOSERVER in MAP_BASELAYERS:
MAP_BASELAYERS.remove(LOCAL_GEOSERVER)
del LOCAL_GEOSERVER
# Change context processors
geoserver_context_processor = 'geonode.geoserver.context_processors.geoserver_urls'
if geoserver_context_processor in TEMPLATES[0]['OPTIONS']['context_processors']:
TEMPLATES[0]['OPTIONS']['context_processors'].remove(geoserver_context_processor)
qgis_server_context_processor = 'geonode.qgis_server.context_processors.qgis_server_urls'
TEMPLATES[0]['OPTIONS']['context_processors'].append(qgis_server_context_processor)
# Leaflet config
GEONODE_CLIENT_LAYER_PREVIEW_LIBRARY = 'leaflet'
GEONODE_CLIENT_HOOKSET = "geonode.client.hooksets.LeafletHookSet"
LEAFLET_CONFIG = {
'TILES': [
# Map Quest
('Map Quest',
'http://otile4.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.png',
'Tiles Courtesy of <a href="http://www.mapquest.com/">MapQuest</a> '
'&mdash; Map data &copy; '
'<a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'),
],
'PLUGINS': {
'esri-leaflet': {
'js': 'lib/js/esri-leaflet.js',
'auto-include': True,
},
'leaflet-fullscreen': {
'css': 'lib/css/leaflet.fullscreen.css',
'js': 'lib/js/Leaflet.fullscreen.min.js',
'auto-include': True,
},
},
'SRID': 3857,
'RESET_VIEW': False
}
# Legacy from Geoserver
OGC_URL_INSIDE = os.environ.get('OGC_URL_INSIDE', SITEURL)
# Not using GeoFence if using QGIS Server Backend
GEOFENCE_SECURITY_ENABLED = False
OGC_SERVER = {
'default': {
'BACKEND': 'geonode.qgis_server',
'LOCATION': OGC_URL_INSIDE + 'qgis-server/',
'PUBLIC_LOCATION': SITEURL + 'qgis-server/',
'GEOFENCE_SECURITY_ENABLED': GEOFENCE_SECURITY_ENABLED
}
}
# OGC (WMS/WFS/WCS) Server Settings
tiles_directory = os.path.join(PROJECT_ROOT, "qgis_tiles")
QGIS_SERVER_URL = os.environ.get(
'QGIS_SERVER_URL', 'http://qgis-server/')
QGIS_SERVER_CONFIG = {
'tiles_directory': tiles_directory,
'tile_path': tiles_directory + '/%s/%s/%d/%d/%d.png',
'legend_path': tiles_directory + '/%s/%s/legend.png',
'thumbnail_path': tiles_directory + '/%s/thumbnail.png',
'map_tile_path': os.path.join(
tiles_directory, '%s', 'map_tiles', '%s', '%s', '%s', '%s.png'),
'qgis_server_url': QGIS_SERVER_URL,
'layer_directory': os.path.join(PROJECT_ROOT, "qgis_layer")
}
import ast
on_travis = ast.literal_eval(os.environ.get('ON_TRAVIS', 'False'))
integration_tests = ast.literal_eval(os.environ.get('TEST_RUN_INTEGRATION', 'False'))
SKIP_GEOSERVER_TEST = on_travis
CELERY_TASK_ALWAYS_EAGER = ast.literal_eval(
os.environ.get('CELERY_TASK_ALWAYS_EAGER', 'True'))
You can’t perform that action at this time.