[GeoNode-users] how to debug geonode

Eugenio Trumpy frippe12573 at hotmail.com
Mon Nov 2 06:47:22 PST 2015





Hi Ariel,

I tried to follow your suggestions, here below the outputs: 

In [1]: from django.contrib.auth.models import User

In [2]: from geonode.maps.models import Map

In [3]: user = User.objects.get(username='eugenio')
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-3-9b6dc19a25ca> in <module>()
----> 1 user = User.objects.get(username='eugenio')

/usr/local/lib/python2.7/dist-packages/django/db/models/manager.pyc in __get__(self, instance, type)
    271     def __get__(self, instance, type=None):
    272         raise AttributeError("Manager isn't available; %s has been swapped for '%s'" % (
--> 273             self.model._meta.object_name, self.model._meta.swapped
    274         ))
    275 

AttributeError: Manager isn't available; User has been swapped for 'people.Profile'

In [4]: map_obj = Map.objects.get(id=35)

In [5]: config = map_obj.viewer_json(user)
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-5-0e77e5c41b4e> in <module>()
----> 1 config = map_obj.viewer_json(user)

NameError: name 'user' is not defined

In [6]: config = map_obj.viewer_json(eugenio)
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-6-3bb56d08e837> in <module>()
----> 1 config = map_obj.viewer_json(eugenio)

NameError: name 'eugenio' is not defined

Actually I don't know if those info are important.

By the way I continuous by inserting ipdb in line of utils.py

Since apache gave me the error at 256 line: str(int(keys[-1]) + 1)] = settings.MAP_BASELAYERS[0]['source']
I put the line for the break at line 266: import ipdb; ipdb.set_trace()

the I run python -m ipdb manage.py shell

but I don't know how to go on through.

E.

From: ingenieroariel at gmail.com
Date: Mon, 2 Nov 2015 08:23:13 -0500
Subject: Re: [GeoNode-users] how to debug geonode
To: frippe12573 at hotmail.com
CC: geonode-users at lists.osgeo.org

Eugenio,
On a high level, what is going on is that GeoNode serializes the ma information into json, puts it back in the database and when you are about to view it, it tries to deserialize it and identify where GeoServer is. That whole line where it plays with the index[1] seems like a weak point and something that can be improved. That seems to be failing in your use case, both when saving and when viewing, not sure what is different in your installation but I believe it would be great to improve that part of the codebase to accommodate your setup.
To debug the issue, you do not need to worry about Apache, just replicate what it is doing:
python manage.py shell
from django.contrib.auth.models import Userfrom geonode.maps.models import Mapuser = User.objects.get(username='yournamehere')map_obj = Map.objects.get(id=<mapid>)config = map_obj.viewer_json(user)

With this, you should be able to see the same error. If that is not the case, then you can still open up the file /dati/geonode/geonode/utils.py in line 265 and start breaking that line of code into smaller lines that do the same thing and see where it is that it breaks. In particular, what is in the keys object, printing it to the error log, etc.
-a
[1]  ... str(int(keys[-1]) + 1)] = settings.MAP_BASELAYERS[0]['source']
On Mon, Nov 2, 2015 at 5:08 AM, Eugenio Trumpy <frippe12573 at hotmail.com> wrote:



Sorry I sent this email before finish it.

Following the last line:

then I run: python -m ipdb manage.py runserver

I entered in the ipdb shell, but now I don't know what I have to do to understand what does produce the error.
Can you help me?

Just to give you some more info, my sistem is ubuntu 14.04 server, apache is 2.4.7, tomcat is 7 and geonode 2.4.dev20151029080001.
Running my installation with the DEV server everythings works fine.

thank you

best

Eugenio



From: frippe12573 at hotmail.com
To: geonode-users at lists.osgeo.org
Subject: how to debug geonode
Date: Mon, 2 Nov 2015 10:38:36 +0100




Hello everybody,

unfortunately something is going wrong onmy geonode installation (it's a custom installation from git).
Actually almost all the functions are working, but the only one that gives me problem is the map save (I wrote the days before here in the list but any answer was good to solve this issue), so geonode developers suggested me to work with the IPDB debugger.

My issues is on the function to save maps. I got a generic 500 internal server error on saving from the geonode interface. Apache error log stated a segmentation fault on wsgi module. Although I got this error on saving maps, the application insert a record in the geonode DB, in fact I can see the map listed on the portal, however if I choose such map I got a page error reporting an error like: list index out of range. The apache error log reports:
[:error] [pid 30692] Internal Server Error: /maps/116
[Mon Oct 12 17:44:22.050107 2015] [:error] [pid 30692] Traceback (most recent call last):
[Mon Oct 12 17:44:22.050114 2015] [:error] [pid 30692]   File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 112, in get_response
[Mon Oct 12 17:44:22.050120 2015] [:error] [pid 30692]     response = wrapped_callback(request, *callback_args, **callback_kwargs)
[Mon Oct 12 17:44:22.050125 2015] [:error] [pid 30692]   File "/dati/geonode/geonode/maps/views.py", line 112, in map_detail
[Mon Oct 12 17:44:22.050130 2015] [:error] [pid 30692]     config = map_obj.viewer_json(request.user)
[Mon Oct 12 17:44:22.050135 2015] [:error] [pid 30692]   File "/dati/geonode/geonode/utils.py", line 265, in viewer_json
[Mon Oct 12 17:44:22.050140 2015] [:error] [pid 30692]     str(int(keys[-1]) + 1)] = settings.MAP_BASELAYERS[0]['source']
[Mon Oct 12 17:44:22.050145 2015] [:error] [pid 30692] IndexError: list index out of range

That's why I would like to debug geonode.
Unfortunately I never did it, reading something on the web I did as follow:

I put this line in the utils.py file after the lines which report BASELAYERS:

import ipdb; ipdb.set_trace()

 		 	   		   		 	   		  

_______________________________________________

geonode-users mailing list

geonode-users at lists.osgeo.org

http://lists.osgeo.org/mailman/listinfo/geonode-users




 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geonode-users/attachments/20151102/704a0fef/attachment.html>


More information about the geonode-users mailing list