[GeoNode-devel] Using geonode-updateip with a custom geonode-project

Dave Kennewell davekennewell at gmail.com
Fri Sep 8 05:56:16 PDT 2017


Hi Rob  - let me have a look at this concept once I solve this immediate
challenge :)

Hi Simone,

OK, so I tested this and

os.environ['DJANGO_SETTINGS_MODULE'] = 'mygeonodeproject.settings'

works to set the settings module correctly. We were correct -
fixoauthuri.py was pulling settings from geonode.settings not
mygeonodeproject.settings. But this doesn't solve the issue unfortunately.
It's still importing the people.profile model from the local database, not
the remote one.

To further debug, I opened the django shell as my geonode user (in my case
it's "ubuntu")

python manage.py shell

from /home/ubuntu/mygeonodeproject, and ran the commands from
fixoauthuri.py. This worked fine - they pick up my superuser created on the
remote database.

So, this leads me to believe the problem lies with fixoauthuri.py being run
as "root" user when called using "sudo geonode-updateip myIpAddress". But
I'm stuck as to further reasons why this is the problem.

To be specific:

When I use

from geonode.people.models import Profile


as *root from "sudo geonode-updateip"*, it imports Profile from the local
database.

When I use

from geonode.people.models import Profile


as *ubuntu from the shell,* it imports Profile from the remote database.


And just for completeness, when I use

from geonode.people.models import Profile


as *root from the shell *("sudo python manage.py shell"), it imports
Profile from the remote database.

Any ideas how to remedy this one?

On 8 September 2017 at 10:59, Simone Dalmasso <simone.dalmasso at gmail.com>
wrote:

> Hi Dave,
>
> good catch, we need to fix this. I guess an approach like manage.py is
> using https://github.com/GeoNode/geonode-project/blob/2.6/manage.py#L10,
> added before the import could work but needs to be tested...
>
> Let me know
>
> 2017-09-07 18:32 GMT+02:00 Dave Kennewell <davekennewell at gmail.com>:
>
>> Hi Geonode Devs,
>>
>> I'm using geonode 2.6.3 installed by apt-get on a fresh ubuntu 16.04
>> instance.
>>
>> On top of this I install geonode-project, and customise settings.py in
>> mygeonodeproject.
>>
>> This works fine if I use the postgres database that apt-get automatically
>> installs locally on my geonode server.
>>
>> However, when I go to swap out this local database with a remote one
>> (it's on AWS RDS), it's all good until the command "sudo geonode-updateip
>> mygeonodeproject.com" tells me I don't have a superuser created (I do,
>> but it's on the remote database, created using the manage.py command in
>> mygeonodeproject folder).
>>
>> When I drill into this a bit deeper, it appears to come down to this
>> line:
>>
>> https://github.com/GeoNode/geonode/blob/2.6.x/geonode/base/
>> management/commands/fixoauthuri.py#L33
>>
>> This line ("from django.conf import settings") is pulling in models from
>> the local geonode database, not the remote RDS database I'm using for
>> mygeonodeproject.
>>
>> What am I doing wrong here, and what is the best way to import my custom
>> project into this command rather than the globally installed geonode, when
>> using "from django.conf import settings"?
>>
>> thanks for any help
>> regards
>> Dave
>>
>>
>> _______________________________________________
>> geonode-devel mailing list
>> geonode-devel at lists.osgeo.org
>> https://lists.osgeo.org/mailman/listinfo/geonode-devel
>>
>>
>
>
> --
> Simone
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geonode-devel/attachments/20170908/873efded/attachment-0001.html>


More information about the geonode-devel mailing list