[GeoNode-users] Geonode-Project Inherited by Geonode Production

Julierme Pinheiro juliermeopensourcedeveloper at gmail.com
Mon Aug 20 14:10:07 PDT 2018


HI Alessio,

Please, where it says Alias /uploaded/
/home/geonode/geonode_proj/geonode_proj/uploaded/
in all scenarios change to:

Alias /templates/ /home/geonode/geonode_proj/geonode_proj/templates/

Kind regards

Julierme

On Mon, Aug 20, 2018 at 4:57 PM, Julierme Pinheiro <
juliermeopensourcedeveloper at gmail.com> wrote:

> Hi Alessio,
>
> Thank you very much for reply. I went through all your highlights. I have
> site_base.css, site_index.html and site_base.html being displayed.
>
> I am still confused with one thing:
>
> I have geonode production in /home/geonode/my_geonode/*  (virtualenv
> geonode)
>
> I have geonode project in /home/geonode/geonode_proj/* (virtualenv geonode)
>
> I set geonode.conf as follow:
>
> WSGIScriptAlias / /home/geonode/geonode_proj/geonode_proj/wsgi.py
> (geonode-project wsgi.py)
>
> Alias /uploaded/ /home/geonode/geonode_proj/geonode_proj/uploaded/
>
> Alias /static/ /home/geonode/geonode_proj/geonode_proj/static_root/
>
> I have Accounts, Emails, SITEURL and ALLOWED_HOSTS set in geonode
> production and geonode_proj settings.py
>
> Within this entire configuration I got geonode set the way I want, but it
> seems that geonode production is out of context/ out of the flow. Is not
> it? As you can see above I have hot used geonode production path in
> anywhere.
>
>
> Yet, related to your highlights, if I change geonode project wsgi.py, in a
> way that it retrieves the geonode production wsgi.py and geonode's site
> display its default configuration, templates, but css which is retrieved
> from geonode project.
>
> Also, if I change geonode production wsgi.py to retrieve its
> local_settings.py, apache won't start.
>
> I have geonode production at 2.8.0 (settings and local_settings) configured
> as in [1].
>
>
> These are the scenarios:
>
> Scenario 1
>
> 1 - geonode production and geonode project installed in the same virtualenv
>
> 1.1 geonode production installed as in [1]
>
> 1.2 geonode.conf configuration
>
> WSGIScriptAlias / /home/geonode/geonode_proj/geonode_proj/wsgi.py
> (geonode-project wsgi.py)
>
> Alias /uploaded/ /home/geonode/geonode_proj/geonode_proj/uploaded/
>
> Alias /static/ /home/geonode/geonode_proj/geonode_proj/static_root/
>
> 1.3 geonode project settings.py
>
> geonode project settings.py got the same SITEURL, ALLOWED_HOSTS, ACCOUNTS
> and EMAILS configuration as in geonode production
>
> This is the closest I can get to what it is stated in [2].
>
> 1.4 Response:
>
> 1.4.1 I can have accounts being set and uploading layers, and everything
> taking place in geonode project path.
>
> 1.4.2 - Geonode production retrieves site_base.css in geonode_project path
>
> 1.4.3 - Geonode production retrieves the templates (site_index.html and
> site_base.html) folder in geonode project.
>
>
>
>
> Scenario 2:
>
>
> 2 - geonode production and geonode project installed in the same virtualenv
>
> 2.1 geonode production installed as in [1]
>
> 2.2 geonode.conf configuration
>
> WSGIScriptAlias / /home/geonode/my_geonode/my_geonode/wsgi.py
> (geonode-production wsgi.py)
>
> Alias /templates/ /home/geonode/geonode_proj/geonode_proj/uploaded/
>
> Alias /static/ /home/geonode/geonode_proj/geonode_proj/static_root/
>
>
> 2.3 Responses:
>
> 2.3.1 - I can have accounts being set and uploading layers, and everything
> taking place in geonode production path, except the static_root coming from
> geonode_project
>
> 2.3.2 - Geonode production retrieves site_base.css in geonode_project path
>
> 2.3.3 - Geonode production won't retrieve the templates folder in geonode
> project, though I set apache2 to do so.
>
>
> Scenario 3:
>
> Changing geonode project wsgi.py, in a way that it retrieves the geonode
> production wsgi.py and keeping the configuration in Scenario 1, geonode's
> site display its default configuration, templates. But it retrieves the css
> in geonode project.
>
> Scenario 4:
>
> Keeping the configuration in Scenario 2 and changing production wsgi.py to
> retrieve production local_settings.py instead of settings.py, apache2 won't
> start.
>
>
> Thank you very much for your time, help and patience.
>
> I appreciated it
>
> Julierme
>
>
>
> [1] http://docs.geonode.org/en/master/tutorials/install_and_
> admin/geonode_install/setup_configure_httpd.html
> [2] http://geonode.org/dev-workshop/#/8/3
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> On Mon, Aug 20, 2018 at 6:44 AM, Alessio Fabiani <alessio.fabiani at geo-
> solutions.it> wrote:
>
>> Hi Julierme,
>> few clarifications on how settings work. It might be useful for your use
>> case.
>>
>> 1. geonode-project settings
>> =====================
>>
>> Settings are taken from wsgi.py mostly, pointed from your HTTPD
>> configuration file.
>>
>> geonode-project by default tries to use it's own settings which inherits
>> (by default) from geonode.settings
>>
>> see here
>>
>> https://github.com/geosolutions-it/geonode-project/blob/
>> master/project_name/wsgi.py#L38
>>
>> this line will be converted into
>>
>> os.environ.setdefault("DJANGO_SETTINGS_MODULE",
>> "your_custom_project.settings")
>>
>> One solution to make it use directly the geonode settings (or other ones)
>> would be to just change this line. As an instance if you have a
>> "produtcion_settings.py" on geonode, you could write something like
>>
>> os.environ.setdefault("DJANGO_SETTINGS_MODULE",
>> "geonode.production_settings")
>>
>> Or if you have your local_settings.py on GeoNode and you want to use that
>> ones you can write
>>
>> os.environ.setdefault("DJANGO_SETTINGS_MODULE", "geonode.local_settings")
>>
>> 2. Django settings inheritance
>> =======================
>>
>> In Django settings module can inherits from other ones. This is possible
>> through the "import" directive.
>>
>> As an instance, typically, "local_settings" inherits from "settings" in
>> order to override some of the original properties. Nevertheless there exist
>> different policies around.
>>
>> Currently geonode_project does:
>>
>> a) If *no *geonode_project/local_settings.py exists, it inherits from
>> geonode/settings.py directly
>>
>> https://github.com/geosolutions-it/geonode-project/blob/
>> master/project_name/settings.py#L26
>>
>> b) If geonode_project/local_settings.py exists, it inherits from those
>> ones
>>
>> https://github.com/geosolutions-it/geonode-project/blob/
>> master/project_name/settings.py#L27
>>
>> and local_settings.py (at least the sample ones, no need to use those
>> ones) inherits from geonode/settings.py
>>
>> https://github.com/geosolutions-it/geonode-project/blob/
>> master/project_name/local_settings.py.sample#L24
>>
>>
>> Hope this helps.
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> Il giorno ven 17 ago 2018 alle ore 18:25 Julierme Pinheiro <
>> juliermeopensourcedeveloper at gmail.com> ha scritto:
>>
>>> Hi Alessio,
>>>
>>> Thank you very much for your reply and  explanation. I can see all your
>>> highlights when, according to [1] / fourth marker bullet, I use the WSGI.py
>>> of geonode-project <WSGIScriptAlias / /home/geonode/geonode_proj/geonode_proj/wsgi.py>.
>>> I see site_base.css, site_index.html and site_base.html being used.
>>> However, pointing to geonode-project wsgi.py, it will retrieve
>>> geonode-project settings.py. And there is a problem, because I need the
>>> production settings.py.
>>>
>>> In the other hand, If I point to geonode production wsgi.py, it will
>>> retrieve production settings.py, and that is what I want. Furthermore, yet,
>>> using production wsgi.py,  I created an Alias to geonode-project
>>> static_root folder in order to have apache2 retrieving  site_base.css
>>> <Alias /static/ /home/geonode/geonode_proj/geonode_proj/static_root>
>>> and fine, site_base.css is being inherited, while production wsgi.py is
>>> being used.
>>>
>>> The same analogy, pointing to production wsgi.py which retrieves
>>> production's settings.py, I created an Alias to geonode_project
>>> subdirectories in order to get its urls.py and templates and I added the
>>> <Directory>:
>>>
>>>     Alias /geonode_proj/ /home/geonode/geonode_proj/geonode_proj/
>>>     Alias /templates/ /home/geonode/geonode_proj/geonode_proj/templates/
>>>     Alias /site_index.html /home/geonode/geonode_proj/geo
>>> node_proj/templates/site_index.html
>>>     Alias /site_base.html /home/geonode/geonode_proj/geo
>>> node_proj/templates/site_base.html
>>>     Alias /geonode_base.html /home/geonode/geonode_proj/geo
>>> node_proj/templates/geonode_base.htm
>>>     Alias /static/ /home/geonode/geonode_proj/geonode_proj/static_root/
>>>
>>>  <Directory "/home/geonode/geonode_proj/geonode_proj/">
>>>         Order allow,deny
>>>         Options Indexes FollowSymLinks
>>>         Allow from all
>>>         Require all granted
>>>     </Directory>
>>>
>>>     <Directory "/home/geonode/geonode_proj/geonode_proj/templates/">
>>>         Order allow,deny
>>>         Options Indexes FollowSymLinks
>>>         Allow from all
>>>         Require all granted
>>>     </Directory>
>>>
>>>     <Directory "/home/geonode/geonode_proj/geonode_proj/static_root/">
>>>         Order allow,deny
>>>         Options Indexes FollowSymLinks
>>>         Allow from all
>>>         Require all granted
>>>     </Directory>
>>>
>>>
>>> Final Response: Using geonode production wsgi.py, and Alias to
>>> geonode_project/static_root and Alias to geonode_project/templates, geonode
>>> production retrieves site_base.css in geonode_project, but geonode_project
>>> site_index.html, site_base.html and geonode_base.html.
>>>
>>> Hypotheses: geonode-production still using its default site_index.html,
>>> site_base.html and geonode_base.html.
>>>
>>> Test: I copied geonode-project site_index.html, site_base.html  to
>>> geonode-production's template folder.
>>>
>>>
>>> Result: geonode-production site changed.
>>>
>>>
>>>
>>> Conclusions: according to the Result, Test and Final Response, I
>>> concluded that using geonode-production's wsgi, and Alias to
>>> geonode-project static_root and templates, geonode-production changes its
>>> css, but its templates (index and base (footer and header)).
>>>
>>>
>>> What I understood so far:
>>>
>>> 1 - Geonode Production installed in a virtualenv
>>>
>>> 2 - Geonode Project installed in the same Geonode Production virtualenv
>>>
>>> 3 - How to change Production site
>>>
>>> 3.1 - Edit site_base.css in geonode_project/static
>>> 3.2 - Edit site_index.html and site_base.html in
>>> geonode_project/templates
>>> 3.3 - Collect the files through python manage.py collectstatic
>>>
>>> 4 - Edit geonode.conf # http://geonode.org/dev-workshop/#/8/3
>>>
>>> 4.1 .Fourth bullet in # http://geonode.org/dev-workshop/#/8/3.  - edit
>>> /etc/apache2/sites-enabled/geonode.conf replacing the wsgi path to the
>>> my_geonode/my_geonode/wsgi.py
>>>
>>> In here, says to point to geonode-project wsgi.py, but doing that,
>>> production settings.py is out of the flow, if I am not wrong. Though I see
>>> all the changes done through site_base.css, site_index.html, site_base.html.
>>>
>>> 4.2. Fifth bullet  in # http://geonode.org/dev-workshop/#/8/3 -
>>>
>>> <Directory "/path/to/my_geonode/">
>>>      Order allow,deny
>>>      Require all granted
>>> </Directory>
>>>
>>>
>>> I did all that except, I am pointing to geonode production wsgi.py in
>>> order to use production settings.py. Besides the Alias created to
>>> geonode-project to have its static_root and templates. CSS is being
>>> retrieved, but site_index.html and site_base.html.
>>>
>>>
>>> Thank you very much for your time and patience.
>>>
>>> Kind regards
>>>
>>> Julierme
>>>
>>>
>>>
>>> [1] http://geonode.org/dev-workshop/#/8/3
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> On Fri, Aug 17, 2018 at 5:32 AM, Alessio Fabiani <
>>> alessio.fabiani at geo-solutions.it> wrote:
>>>
>>>> Hello Julierme,
>>>> I'm going to start providing to you some pointers on how
>>>> geonode-project Django template overrides GeoNode core ones.
>>>>
>>>> 1. The main URL entry "site_index.html"
>>>> ------------------------------------------------------
>>>>
>>>> This is the very first thing to consider. geonode-project overrides the
>>>> default GeoNode main index through the "urls.py" file. Instead of using the
>>>> default GeoNode one, it says to Django to use its own defined here
>>>>
>>>> https://github.com/geosolutions-it/geonode-project/blob/
>>>> master/project_name/templates/site_index.html
>>>>
>>>>
>>>> 2. "site_index.html"
>>>> --------------------------
>>>> This one inherits from GeoNode "index.html"
>>>>
>>>> see https://github.com/geosolutions-it/geonode-project/blob/
>>>> master/project_name/templates/site_index.html#L1
>>>>
>>>> Nevertheless geonode-project also overrides the "geonode_base.html"
>>>> (see https://github.com/geosolutions-it/geonode-project/
>>>> blob/master/project_name/templates/geonode_base.html ) which inherits
>>>> the local "site_base.html" (see https://github.com/geosol
>>>> utions-it/geonode-project/blob/master/project_name/
>>>> templates/site_base.html )
>>>>
>>>> 3. "site_base.html"
>>>> -------------------------
>>>>
>>>> The geonode-project "site_base.html" inherits the GeoNode "base.html"
>>>>
>>>>
>>>>
>>>> Il giorno gio 16 ago 2018 alle ore 22:09 Julierme Pinheiro <
>>>> juliermeopensourcedeveloper at gmail.com> ha scritto:
>>>>
>>>>> Dear users and contributors,
>>>>>
>>>>> I am still trying to figure out the way Apache2/geonode.conf is
>>>>> configured in order to have geonode production inheriting the changes in
>>>>> geonode-project, mainly ./geonode_proj/static_root/css/site_base.css
>>>>> and ./geonode_proj/templates/site_index.html and site_base.html.
>>>>>
>>>>> Based on [1]  I added the following lines to  the geonode.conf which
>>>>> default configuration is found in [2]:
>>>>>
>>>>>     Alias /static/ /home/geonode/geonode_proj/geo
>>>>> node_proj/static_root/
>>>>>     Alias /templates/ /home/geonode/geonode_proj/geo
>>>>> node_proj/templates/
>>>>>     Alias /site_index.html /home/geonode/geonode_proj/geo
>>>>> node_proj/templates/site_index.html
>>>>>     Alias /site_base.html /home/geonode/geonode_proj/geo
>>>>> node_proj/templates/site_base.html
>>>>>
>>>>>
>>>>> ############################### New Configuration for site
>>>>> inheritance ###############################
>>>>>     <Directory "/home/geonode/geonode_proj/">
>>>>>         Order allow,deny
>>>>>         Options Indexes FollowSymLinks
>>>>>         Allow from all
>>>>>         Require all granted
>>>>>     </Directory>
>>>>>
>>>>>     <Directory "/home/geonode/geonode_proj/geonode_proj/templates/">
>>>>>         Order allow,deny
>>>>>         Options Indexes FollowSymLinks
>>>>>         Allow from all
>>>>>         Require all granted
>>>>>     </Directory>
>>>>>
>>>>>     <Directory "/home/geonode/geonode_proj/geonode_proj/static_root/">
>>>>>         Order allow,deny
>>>>>         Options Indexes FollowSymLinks
>>>>>         Allow from all
>>>>>         Require all granted
>>>>>     </Directory>
>>>>>
>>>>>     <Directory "/home/geonode/geonode_proj/geonode_proj/">
>>>>>          <Files wsgi.py>
>>>>>              Order deny,allow
>>>>>              Allow from all
>>>>>              Require all granted
>>>>>          </Files>
>>>>>
>>>>>         Order allow,deny
>>>>>         Options Indexes FollowSymLinks
>>>>>         Allow from all
>>>>>         IndexOptions FancyIndexing
>>>>>     </Directory>
>>>>>
>>>>> ############################################################
>>>>> ###########################################3
>>>>>
>>>>> Within this configuration, geonode production is inheriting the
>>>>> site_base.css in ./geonode-proj/static_root/css/, but site_index.html
>>>>> and site_base.html.
>>>>>
>>>>> I also have to mention that WSGI being used is production
>>>>> WSGIScriptAlias / /home/geonode/my_geonode/my_geonode/wsgi.py.
>>>>>
>>>>> My first guest is: although I have created all the Alias path
>>>>> (including the templates directory) as showed above, Apache2 still looking
>>>>> for the site_index.html and site_base.html in the production folder
>>>>> /home/geonode/my_geonode/my_geonode/templates/.
>>>>>
>>>>> One thing I can not understand is: I created the Alias for
>>>>> geonode-project static_root and Apache is doing exactly what I want:
>>>>> getting the site_base.css. But why is not doing for the geonode_project
>>>>> templates.
>>>>>
>>>>> To test my first guest, I copied site_index.html and site_base.html to
>>>>> production path /home/geonode/my_geonode/my_geonode/templates and the
>>>>> response was a request to site_base.html, but site_index.html.
>>>>>
>>>>> Lastly, I have to say that I have production and geonode-project in
>>>>> the same virtualenv.
>>>>>
>>>>> I am very confused. Could someone give me a hint on that please? And
>>>>> my apologies for bringing this topic to discussion again.
>>>>>
>>>>> Thank you for your time in advance
>>>>>
>>>>> Kind regards
>>>>>
>>>>> Julierme
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> [1] https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/
>>>>> modwsgi/
>>>>> [2] http://docs.geonode.org/en/master/tutorials/install_and_admi
>>>>> n/geonode_install/setup_configure_httpd.html
>>>>> _______________________________________________
>>>>> 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 -
>>>> <https://maps.google.com/?q=Via+di+Montramito+3/A+-++55054+%C2%A0Massarosa&entry=gmail&source=g>55054
>>>>  Massarosa
>>>> <https://maps.google.com/?q=Via+di+Montramito+3/A+-++55054+%C2%A0Massarosa&entry=gmail&source=g>
>>>> (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.
>>>>
>>>
>>>
>>
>> --
>>
>> ==
>>
>> 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 -
>> <https://maps.google.com/?q=Via+di+Montramito+3/A+-++55054+%C2%A0Massarosa&entry=gmail&source=g>55054
>>  Massarosa
>> <https://maps.google.com/?q=Via+di+Montramito+3/A+-++55054+%C2%A0Massarosa&entry=gmail&source=g>
>> (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/20180820/782a2d46/attachment-0001.html>


More information about the geonode-users mailing list