[GeoNode-users] settings_local.py not reflecting

Alessio Fabiani alessio.fabiani at geo-solutions.it
Wed Oct 3 03:58:00 PDT 2018


Hi ZiZi,
in order to make geonode_generic able to use your custom settings, you will
need basically to do a couple of things:

1. Create a "settings_local.py" or "local_settings.py" or
"whatever_settings.py" by looking at the structure of this sample here
https://github.com/geosolutions-it/geonode-generic/blob/master/geonode_generic/local_settings.py.sample
It is worth notice that you need to import the original settings at the
beginning (
https://github.com/geosolutions-it/geonode-generic/blob/master/geonode_generic/local_settings.py.sample#L22
) and then override/add any other property you need.

2. Make sure you have defined the environment variable "
DJANGO_SETTINGS_MODULE" with the value

DJANGO_SETTINGS_MODULE = "geonode_generic.whatever_settings  "

The WSGI module will look for this env variable definition and if it does
not find it, it will fallback to "geonode.settings"

See as an instance:
https://github.com/geosolutions-it/geonode-generic/blob/master/geonode_generic/wsgi.py#L38


Hope this helps.

Cheers,
Alessio.






Il giorno mar 2 ott 2018 alle ore 09:55 Zizi Jama <mazizi.jama at gmail.com>
ha scritto:

> Hello,
>
> I have a geonode deployment based on
> https://github.com/geosolutions-it/geonode-generic
> This is running on my local machine.
>
> I want to add additional basemaps - according to geonode documentation it
> is recommended that one edits settings_local.py
>
> Is this the correct approach in this instance?
>
> Since I am using containers is it recommended to use docker volume in
> order to persist changes without having to create own image? (This is
> because on restart the changes to settings_local.py)
>
> My settings.local.py looks like this (is it configured properly? These
> are not reflecting in my setup even after restarting the services. Any
> ideas what could be wrong?
>
> # -*- coding: utf-8 -*-
> #########################################################################
> #
> # Copyright (C) 2018 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/>.
> #
> #########################################################################
>
> #import ast
> #import os
> #from urlparse import urlparse, urlunparse
> from geonode.settings import *
>
> # default map projection
> # Note: If set to EPSG:4326, then only EPSG:4326 basemaps will work.
> DEFAULT_MAP_CRS = "EPSG:3857"
>
> DEFAULT_LAYER_FORMAT = "image/png"
>
> # 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 = 11
>
> ALT_OSM_BASEMAPS = os.environ.get('ALT_OSM_BASEMAPS', False)
> CARTODB_BASEMAPS = os.environ.get('CARTODB_BASEMAPS', False)
> STAMEN_BASEMAPS = os.environ.get('STAMEN_BASEMAPS', False)
> THUNDERFOREST_BASEMAPS = os.environ.get('THUNDERFOREST_BASEMAPS', False)
> MAPBOX_ACCESS_TOKEN = os.environ.get('MAPBOX_ACCESS_TOKEN', '')
> BING_API_KEY = os.environ.get('xjxjjxjxjxjjxjxjxjjxjxjxjxjxjxjxjxj_', None)
> GOOGLE_API_KEY = os.environ.get('sisosopspsppspspsppsss', None)
>
> MAP_BASELAYERS = [{
>     "source": {"ptype": "gxp_olsource"},
>     "type": "OpenLayers.Layer",
>     "args": ["No background"],
>     "name": "background",
>     "visibility": False,
>     "fixed": True,
>     "group":"background"
> #}, {
> #    "source": {"ptype": "gxp_olsource"},
> #    "type": "OpenLayers.Layer.XYZ",
> #    "title": "UNESCO",
> #    "args": ["UNESCO", "http://en.unesco.org/tiles/${z}/${x}/${y}.png"],
> #    "wrapDateLine": True,
> #    "name": "background",
> #    "attribution": "© UNESCO",
> #    "visibility": False,
> #    "fixed": True,
> #    "group":"background"
> #}, {
> #    "source": {"ptype": "gxp_olsource"},
> #    "type": "OpenLayers.Layer.XYZ",
> #    "title": "UNESCO GEODATA",
> #    "args": ["UNESCO GEODATA", "
> http://en.unesco.org/tiles/geodata/${z}/${x}/${y}.png"],
> #    "name": "background",
> #    "attribution": "© UNESCO",
> #    "visibility": False,
> #    "wrapDateLine": True,
> #    "fixed": True,
> #    "group":"background"
> #}, {
> #    "source": {"ptype": "gxp_olsource"},
> #    "type": "OpenLayers.Layer.XYZ",
> #    "title": "Humanitarian OpenStreetMap",
> #    "args": ["Humanitarian OpenStreetMap", "
> http://a.tile.openstreetmap.fr/hot/${z}/${x}/${y}.png"],
> #    "name": "background",
> #    "attribution": "© <a href='
> http://www.openstreetmap.org/copyright'>OpenStreetMap</a>, Tiles courtesy
> of <a href='http://hot.openstreetmap.org/' target='_blank'>Humanitarian
> OpenStreetMap Team</a>",
> #    "visibility": False,
> #    "wrapDateLine": True,
> #    "fixed": True,
> #    "group":"background"
> # }, {
> #     "source": {"ptype": "gxp_olsource"},
> #     "type": "OpenLayers.Layer.XYZ",
> #     "title": "MapBox Satellite Streets",
> #     "args": ["MapBox Satellite Streets", "
> http://api.mapbox.com/styles/v1/mapbox/satellite-streets-v9/tiles/${z}/${x}/${y}?access_token=
> "+MAPBOX_ACCESS_TOKEN],
> #     "name": "background",
> #     "attribution": "© <a href='https://www.mapbox.com/about/maps/'>Mapbox</a>
> © <a href='http://www.openstreetmap.org/copyright'>OpenStreetMap</a>
> <a href='https://www.mapbox.com/feedback/' target='_blank'>Improve this
> map</a>",
> #     "visibility": False,
> #     "wrapDateLine": True,
> #     "fixed": True,
> #     "group":"background"
> # }, {
> #     "source": {"ptype": "gxp_olsource"},
> #     "type": "OpenLayers.Layer.XYZ",
> #     "title": "MapBox Streets",
> #     "args": ["MapBox Streets", "
> http://api.mapbox.com/styles/v1/mapbox/streets-v9/tiles/${z}/${x}/${y}?access_token=
> "+MAPBOX_ACCESS_TOKEN],
> #     "name": "background",
> #     "attribution": "© <a href='https://www.mapbox.com/about/maps/'>Mapbox</a>
> © <a href='http://www.openstreetmap.org/copyright'>OpenStreetMap</a>
> <a href='https://www.mapbox.com/feedback/' target='_blank'>Improve this
> map</a>",
> #     "visibility": False,
> #     "wrapDateLine": True,
> #     "fixed": True,
> #     "group":"background"
> }, {
>     "source": {"ptype": "gxp_osmsource"},
>     "type": "OpenLayers.Layer.OSM",
>     "title": "OpenStreetMap",
>     "name": "mapnik",
>     "attribution": "© <a href='http://osm.org/copyright'>OpenStreetMap</a>
> contributors",
>     "visibility": True,
>     "wrapDateLine": True,
>     "fixed": True,
>     "group": "background"
> }, {
>     "source": {"ptype": "gxp_olsource"},
>     "type": "OpenLayers.Layer.XYZ",
>     "title": "CD:NGI AERIAL",
>     "args": ["CD:NGI AERIAL", "
> http://a.aerial.openstreetmap.org.za/ngi-aerial/${z}/${x}/${y}.jpg"],
>     "wrapDateLine": True,
>     "name": "CD:NGI AERIAL",
>     "attribution": "© CD:NGI AERIAL",
>     "visibility": False,
>     "fixed": True,
>     "group":"background"
> #}, {
> #   "source": {
> #             "ptype":"gxp_bingsource",
> #             "apiKey":"xjxjjxjxjxjjxjxjxjjxjxjxjxjxjxjxjxj_"
> #             },
> #   "group":"background",
> #   "name":"Aerial",
> #   "title":"Bing Satellite Imagery",
> #   "visibility": False,
> #   "fixed":True
> #}, {
> #    "source": {"ptype":"gxp_googlesource", otherParams":
> "sensor=false&key={0}".format(GOOGLE_API_KEY)},
> #    "title": "GOOGLE SATELLITE"
> #    "name": "SATELLITE",
> #    "visibility": False,
> #    "fixed": True,
> #    "group":"background"
> }]
>
> if 'geonode.geoserver' in INSTALLED_APPS:
>     LOCAL_GEOSERVER = {
>         "source": {
>             "ptype": "gxp_wmscsource",
>             "url": OGC_SERVER['default']['PUBLIC_LOCATION'] + "wms",
>             "restUrl": "/gs/rest"
>         }
>     }
>     baselayers = MAP_BASELAYERS
>     MAP_BASELAYERS = [LOCAL_GEOSERVER]
>     MAP_BASELAYERS.extend(baselayers)
>
> _______________________________________________
> geonode-users mailing list
> geonode-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/geonode-users
>


-- 

==

GeoServer Professional Services from the experts! Visit http://goo.gl/it488V
for more information.
==
Ing. Alessio Fabiani

@alfa7691
Founder/Technical Lead


GeoSolutions S.A.S.
Via di Montramito 3/A - 55054  Massarosa (LU) - Italy
phone: +39 0584 962313
fax:     +39 0584 1660272
mob:   +39 331 6233686


http://www.geo-solutions.it
http://twitter.com/geosolutions_it
-------------------------------------------------------

Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE
2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si
precisa che ogni circostanza inerente alla presente email (il suo
contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è
riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il
messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra
operazione è illecita. Le sarei comunque grato se potesse darmene notizia.


This email is intended only for the person or entity to which it is
addressed and may contain information that is privileged, confidential or
otherwise protected from disclosure. We remind that - as provided by
European Regulation 2016/679 “GDPR” - copying, dissemination or use of this
e-mail or the information herein by anyone other than the intended
recipient is prohibited. If you have received this email by mistake, please
notify us immediately by telephone or e-mail.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geonode-users/attachments/20181003/706626ea/attachment-0001.html>


More information about the geonode-users mailing list