[GeoNode-users] Customizing Geonode (Installed via apt-get) from Geonode-project Dev (Installed via Python Virtualenv)

Dave Kennewell davekennewell at gmail.com
Thu Apr 19 01:00:34 PDT 2018


Hmmm, I'm not sure. Your conclusions from the tests seem correct.

As Toni mentions, make sure you haven't accidently disabled the datastore
ENGINE with this line:
        'ENGINE': 'django.contrib.gis.db.backends.postgis',
        'ENGINE': '', # Empty ENGINE name disables

it should be the postgis option.

Apart from that, it's difficult to diagnose via email. If your code is in a
public repo I can take a look, or share details to david dot kennewell at
hydrata dot com and I can take a look. We'll report back to the list so
others can learn what we find.

On 18 April 2018 at 23:13, Julierme Pinheiro <
juliermeopensourcedeveloper at gmail.com> wrote:

> Hi Dave Kennewell,
>
> First, let me introduce you the DATABASES configuration to:
>
> *1 - Geonode (apt-get)*
>
>   DATABASE_ENGINE = 'postgresql_psycopg2'
> DATABASE_NAME = 'geonode'
> DATABASE_USER = 'geonode'
> DATABASE_PASSWORD = 'DBImAITC'
> DATABASE_HOST = 'localhost'
> DATABASE_PORT = '5432'
>
>
> DATABASES = {
>     'default': {
>         'ENGINE': 'django.db.backends.postgresql_psycopg2',
>         'NAME': DATABASE_NAME,
>         'USER': DATABASE_USER,
>         'PASSWORD': DATABASE_PASSWORD,
>         'HOST': DATABASE_HOST,
>         'PORT': DATABASE_PORT,
>         'CONN_TOUT': 900,
>     },
>     # vector datastore for uploads
>     'datastore': {
>         'ENGINE': 'django.contrib.gis.db.backends.postgis',
>         'NAME': 'geonode_data',
>         'USER': DATABASE_USER,
>         'PASSWORD': DATABASE_PASSWORD,
>         'HOST': DATABASE_HOST,
>         'PORT': DATABASE_PORT,
>         'CONN_TOUT': 900,
>     }
> }
>
> *2 - Geonode-Project (Virtualenv)*
>
> DATABASES = {
>     'default': {
>          'ENGINE': 'django.db.backends.postgresql_psycopg2',
>          'NAME': 'geonode',
>          'USER': 'geonode',
>          'PASSWORD': 'geonode',
>          'HOST' : 'localhost',
>          'PORT' : '5432',
>          'CONN_TOUT': 900,
>      },
>     # vector datastore for uploads
>     'datastore' : {
>         'ENGINE': 'django.contrib.gis.db.backends.postgis',
>         'ENGINE': '', # Empty ENGINE name disables
>         'NAME': 'geonode_data',
>         'USER' : 'geonode',
>         'PASSWORD' : 'geonode',
>         'HOST' : 'localhost',
>         'PORT' : '5432',
>         'CONN_TOUT': 900,
>     }
> }
>
>
> From both DB configuration, I realized one difference: "the database
> password"
>
> I made some tests which are found bellow with their results:
>
>
> *Test 1: geonode.conf (default created by apt-get installation)*
>
>
> :~$ cd  /etc/julierme_virtualenv/my_geonode/my_geonode/
> :~$ python manage.py shell
> >>>from django.conf import settings
> >>>settings.DATABASES
> {'default': {'ENGINE': 'django.db.backends.postgresql_psycopg2',
> 'AUTOCOMMIT': True, 'ATOMIC_REQUESTS': False, 'NAME': 'geonode',
> 'CONN_MAX_AGE': 0, 'CONN_TOUT': 900, 'TIME_ZONE': 'UTC', 'OPTIONS': {},
> 'HOST': 'localhost', 'USER': 'geonode', 'TEST': {'COLLATION': None,
> 'CHARSET': None, 'NAME': None, 'MIRROR': None}, 'PASSWORD': 'DBImAITC',
> 'PORT': '5432'}, 'datastore': {'ENGINE': 'django.contrib.gis.db.backends.postgis',
> 'NAME': 'geonode_data', 'CONN_TOUT': 900, 'HOST': 'localhost', 'USER':
> 'geonode', 'PASSWORD': 'DBImAITC', 'PORT': '5432'}}
>
>
> *Test 2: geonode.conf (changed according to Geonode-Project WITHOUT
> commenting DATABASES = {...} )*
>
> :~$ cd  /etc/julierme_virtualenv/my_geonode/my_geonode/
> :~$ python manage.py shell
> >>>from django.conf import settings
> >>>settings.DATABASES
> {'default': {'ENGINE': 'django.db.backends.postgresql_psycopg2',
> 'AUTOCOMMIT': True, 'ATOMIC_REQUESTS': False, 'NAME': 'geonode',
> 'CONN_MAX_AGE': 0, 'CONN_TOUT': 900, 'TIME_ZONE': 'UTC', 'OPTIONS': {},
> 'HOST': 'localhost', 'USER': 'geonode', 'TEST': {'COLLATION': None,
> 'CHARSET': None, 'NAME': None, 'MIRROR': None}, 'PASSWORD': 'DBImAITC',
> 'PORT': '5432'}, 'datastore': {'ENGINE': 'django.contrib.gis.db.backends.postgis',
> 'NAME': 'geonode_data', 'CONN_TOUT': 900, 'HOST': 'localhost', 'USER':
> 'geonode', 'PASSWORD': 'DBImAITC', 'PORT': '5432'}}
>
>
> *Test 3: geonode.conf (changed according to Geonode-Project commenting
> DATABASES = {...} )*
>
> :~$ cd  /etc/julierme_virtualenv/my_geonode/my_geonode/
> :~$ python manage.py shell
> >>>from django.conf import settings
> >>>settings.DATABASES
> {'default': {'ENGINE': 'django.db.backends.postgresql_psycopg2',
> 'AUTOCOMMIT': True, 'ATOMIC_REQUESTS': False, 'NAME': 'geonode',
> 'CONN_MAX_AGE': 0, 'CONN_TOUT': 900, 'TIME_ZONE': 'UTC', 'OPTIONS': {},
> 'HOST': 'localhost', 'USER': 'geonode', 'TEST': {'COLLATION': None,
> 'CHARSET': None, 'NAME': None, 'MIRROR': None}, 'PASSWORD': 'DBImAITC',
> 'PORT': '5432'}, 'datastore': {'ENGINE': 'django.contrib.gis.db.backends.postgis',
> 'NAME': 'geonode_data', 'CONN_TOUT': 900, 'HOST': 'localhost', 'USER':
> 'geonode', 'PASSWORD': 'DBImAITC', 'PORT': '5432'}}
>
>
> I may be wrong, but from these tests I have concluded that the database
> being used is always the Geonode (apt-get), because of the password showed
> in settings.DATABASES ('PASSWORD': 'DBImAITC').
>
> What else could be? I am still thinking about.
>
> I appreciated your time.
>
> Kind Regards
>
> Julierme
>
>
> 2018-04-18 14:16 GMT-03:00 Dave Kennewell <davekennewell at gmail.com>:
>
>> OK, I think you can simply delete the "DATABASES = {...}" lines from
>> my_geonode/settings.py which I suspect is overriding the default postgres
>> database with something else.
>>
>> Don't forget to restart apache2 after changing the settings - this will
>> reload them through wsgi - "sudo service apache2 restart"
>>
>> If you want to check exactly which settings are being used by your
>> geonode-project:
>>
>> :~$ cd  /etc/julierme_virtualenv/my_geonode/my_geonode/
>> :~$ python manage.py shell
>> >>>from django.conf import settings
>> >>>settings.DATABASES
>>
>>  should give you all the relevant database configuration that your
>> project is actually using.
>>
>>
>>
>>
>>
>> On 18 April 2018 at 21:04, Julierme Pinheiro <
>> juliermeopensourcedeveloper at gmail.com> wrote:
>>
>>> Hi Dave Kennewell,
>>>
>>> First of all, thank you very much for your prompt reply.
>>>
>>> I understood your highlights. And going back to your questions:
>>>
>>> *The next steps to "fix" this depends on which database you want to use
>>> long-term?*
>>>
>>> The postgresql database used by my Geonode (installed via apt-get) is my
>>> production database and I want to keep it.
>>>
>>> *Does this sound right or do you think it is something else? *
>>>
>>> I think you are right and how I could set my database to be Geonode
>>> (apt-get) the long-term? Should this change be done through the wsgi.py?
>>>
>>> My long-term database configuration installed via apt-get is set in the
>>> /etc/geonode/local_settings.py.
>>>
>>> My wsgi.py and local_settings.py in Geonode-Project (installed via
>>> Python virtualenv), in the other hand, are available in
>>> /etc/julierme_virtualenv/my_geonode/my_geonode/my_geonode/
>>>
>>> So, how can I keep postgresql (long-term) installed via apt-get while I
>>> change geonode.conf in order to use the layout of Geonode-Project?
>>>
>>> Thank you very much for your time.
>>>
>>> I appreciated it.
>>>
>>> Julierme
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> 2018-04-18 12:24 GMT-03:00 Dave Kennewell <davekennewell at gmail.com>:
>>>
>>>> Hi Julierme,
>>>>
>>>> The missing maps and users suggests to me that geonode is now using a
>>>> different database. If it is still working, but just with no maps or users,
>>>> my guess is:
>>>>
>>>> Prior to configuring geonode.conf, you would have been using the
>>>> default postgresql database that is installed with geonode via apt-get.
>>>> This is likely where your 6 maps & 2 users currently reside.
>>>>
>>>> After configuring geonode.conf, you will likely be using
>>>> your_geonode_project.wsgi.py, which will point to
>>>> your_geonode_project.settings. This settings file will override the default
>>>> postgresql database with whatever you have in there (either in
>>>> your_geonode_project.settings or local_settings.py)
>>>>
>>>> The next steps to "fix" this depends on which database you want to use
>>>> long-term?
>>>>
>>>> Does this sound right or do you think it is something else?
>>>>
>>>> regards
>>>> Dave
>>>>
>>>> On 18 April 2018 at 19:13, juliermeopensourcedeveloper [via OSGeo.org]
>>>> <ml+s1560n5361932h7 at n6.nabble.com> wrote:
>>>>
>>>>> Dear all,
>>>>>
>>>>> I just finished configuring *geonode.conf* in order to customize
>>>>> Geonode main layout (installed via apt-get) based on changes made through
>>>>> Geonode-Project Dev layout (installed via Python Virtualenv). Before
>>>>> configuring *geonode.conf*, I had 6 Maps and 2 users in my Geonode
>>>>> and after applying Geonode-Project Dev layout by changing
>>>>> *geonode.conf*, I faced the following problems:
>>>>>
>>>>> 1 - The 6 Maps and 2 Users I had in Geonode are gone;
>>>>>
>>>>> 2 - I am unable to log in even with Geonode default credentials;
>>>>>
>>>>> Could someone tell me why I am facing these problems and figure out
>>>>> one way to fix them?
>>>>>
>>>>>
>>>>> Thank you very much for your time and patience in advance.
>>>>>
>>>>> Best Regards
>>>>>
>>>>> Julierme
>>>>>
>>>>> _______________________________________________
>>>>> geonode-users mailing list
>>>>> [hidden email] <http:///user/SendEmail.jtp?type=node&node=5361932&i=0>
>>>>> https://lists.osgeo.org/mailman/listinfo/geonode-users
>>>>>
>>>>>
>>>>> ------------------------------
>>>>> If you reply to this email, your message will be added to the
>>>>> discussion below:
>>>>> http://osgeo-org.1560.x6.nabble.com/Customizing-Geonode-Inst
>>>>> alled-via-apt-get-from-Geonode-project-Dev-Installed-via-Pyt
>>>>> hon-Virtualenv-tp5361932.html
>>>>> To unsubscribe from GeoNode users, click here
>>>>> <http://osgeo-org.1560.x6.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5185389&code=ZGF2ZWtlbm5ld2VsbEBnbWFpbC5jb218NTE4NTM4OXwtOTI1NjEyMTk0>
>>>>> .
>>>>> NAML
>>>>> <http://osgeo-org.1560.x6.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> geonode-users mailing list
>>>> geonode-users at lists.osgeo.org
>>>> https://lists.osgeo.org/mailman/listinfo/geonode-users
>>>>
>>>>
>>>
>>
>> _______________________________________________
>> geonode-users mailing list
>> geonode-users at lists.osgeo.org
>> https://lists.osgeo.org/mailman/listinfo/geonode-users
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geonode-users/attachments/20180419/fe5086d9/attachment-0001.html>


More information about the geonode-users mailing list