<html>
<head>
</head>
<body class='hmmessage'><div dir='ltr'>

<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style>
<div dir="ltr"><br>Hi Ariel,<br><br>I tried to follow your suggestions, here below the outputs: <br><br>In [1]: from django.contrib.auth.models import User<br><br>In [2]: from geonode.maps.models import Map<br><br>In [3]: user = User.objects.get(username='eugenio')<br>---------------------------------------------------------------------------<br>AttributeError                            Traceback (most recent call last)<br><ipython-input-3-9b6dc19a25ca> in <module>()<br>----> 1 user = User.objects.get(username='eugenio')<br><br>/usr/local/lib/python2.7/dist-packages/django/db/models/manager.pyc in __get__(self, instance, type)<br>    271     def __get__(self, instance, type=None):<br>    272         raise AttributeError("Manager isn't available; %s has been swapped for '%s'" % (<br>--> 273             self.model._meta.object_name, self.model._meta.swapped<br>    274         ))<br>    275 <br><br>AttributeError: Manager isn't available; User has been swapped for 'people.Profile'<br><br>In [4]: map_obj = Map.objects.get(id=35)<br><br>In [5]: config = map_obj.viewer_json(user)<br>---------------------------------------------------------------------------<br>NameError                                 Traceback (most recent call last)<br><ipython-input-5-0e77e5c41b4e> in <module>()<br>----> 1 config = map_obj.viewer_json(user)<br><br>NameError: name 'user' is not defined<br><br>In [6]: config = map_obj.viewer_json(eugenio)<br>---------------------------------------------------------------------------<br>NameError                                 Traceback (most recent call last)<br><ipython-input-6-3bb56d08e837> in <module>()<br>----> 1 config = map_obj.viewer_json(eugenio)<br><br>NameError: name 'eugenio' is not defined<br><br>Actually I don't know if those info are important.<br><br>By the way I continuous by inserting ipdb in line of utils.py<br><br>Since apache gave me the error at 256 line: str(int(keys[-1]) + 1)] = settings.MAP_BASELAYERS[0]['source']<br>I put the line for the break at line 266: import ipdb; ipdb.set_trace()<br><br>the I run python -m ipdb manage.py shell<br><br>but I don't know how to go on through.<br><br>E.<br><br><div><hr id="stopSpelling">From: ingenieroariel@gmail.com<br>Date: Mon, 2 Nov 2015 08:23:13 -0500<br>Subject: Re: [GeoNode-users] how to debug geonode<br>To: frippe12573@hotmail.com<br>CC: geonode-users@lists.osgeo.org<br><br><div dir="ltr">Eugenio,<div><br></div><div>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.</div><div><br></div><div>To debug the issue, you do not need to worry about Apache, just replicate what it is doing:</div><div><br></div><div>python manage.py shell</div><div><br></div><div>from django.contrib.auth.models import User</div><div>from geonode.maps.models import Map</div><div>user = User.objects.get(username='yournamehere')</div><div>map_obj = Map.objects.get(id=<mapid>)</div><div><span style="font-size:13px;">config = map_obj.viewer_json(</span><span style="font-size:13px;">user)</span><br></div><div><br></div><div>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 <span style="font-size:13px;">/dati/geonode/geonode/utils.</span><span style="font-size:13px;">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.</span></div><div><span style="font-size:13px;"><br></span></div><div><span style="font-size:13px;">-a</span></div><div><br></div><div>[1]  ... <span style="font-size:13px;">str(int(keys[-1]) + 1)] = settings.MAP_BASELAYERS[0]['</span><span style="font-size:13px;">source']</span></div></div><div class="ecxgmail_extra"><br><div class="ecxgmail_quote">On Mon, Nov 2, 2015 at 5:08 AM, Eugenio Trumpy <span dir="ltr"><<a href="mailto:frippe12573@hotmail.com" target="_blank">frippe12573@hotmail.com</a>></span> wrote:<br><blockquote class="ecxgmail_quote" style="border-left:1px #ccc solid;padding-left:1ex;">


<div><div dir="ltr">Sorry I sent this email before finish it.<br><br>Following the last line:<br><br>then I run: python -m ipdb manage.py runserver<br><br>I entered in the ipdb shell, but now I don't know what I have to do to understand what does produce the error.<br>Can you help me?<br><br>Just to give you some more info, my sistem is ubuntu 14.04 server, apache is 2.4.7, tomcat is 7 and geonode<em> 2.4.dev20151029080001</em>.<br>Running my installation with the DEV server everythings works fine.<br><br>thank you<br><br>best<span class="ecxHOEnZb"><font color="#888888"><br><br>Eugenio<br></font></span><div class="ecxhm ecxHOEnZb"><br><br><br></div><div><div class="ecxhm ecxHOEnZb"><hr>From: <a href="mailto:frippe12573@hotmail.com" target="_blank">frippe12573@hotmail.com</a><br>To: <a href="mailto:geonode-users@lists.osgeo.org" target="_blank">geonode-users@lists.osgeo.org</a><br>Subject: how to debug geonode<br>Date: Mon, 2 Nov 2015 10:38:36 +0100</div><div><div class="h5"><br><br>


<div dir="ltr">Hello everybody,<br><br>unfortunately something is going wrong onmy geonode installation (it's a custom installation from git).<br>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.<br><br>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:<br>[:error] [pid 30692] Internal Server Error: /maps/116<br>[Mon Oct 12 17:44:22.050107 2015] [:error] [pid 30692] Traceback (most recent call last):<br>[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<br>[Mon Oct 12 17:44:22.050120 2015] [:error] [pid 30692]     response = wrapped_callback(request, *callback_args, **callback_kwargs)<br>[Mon Oct 12 17:44:22.050125 2015] [:error] [pid 30692]   File "/dati/geonode/geonode/maps/views.py", line 112, in map_detail<br>[Mon Oct 12 17:44:22.050130 2015] [:error] [pid 30692]     config = map_obj.viewer_json(request.user)<br>[Mon Oct 12 17:44:22.050135 2015] [:error] [pid 30692]   File "/dati/geonode/geonode/utils.py", line 265, in viewer_json<br>[Mon Oct 12 17:44:22.050140 2015] [:error] [pid 30692]     str(int(keys[-1]) + 1)] = settings.MAP_BASELAYERS[0]['source']<br>[Mon Oct 12 17:44:22.050145 2015] [:error] [pid 30692] IndexError: list index out of range<br><br>That's why I would like to debug geonode.<br>Unfortunately I never did it, reading something on the web I did as follow:<br><br>I put this line in the utils.py file after the lines which report BASELAYERS:<br><br><pre><code><span>import</span> ipdb; ipdb.set_trace()</code></pre><br><br>                                         </div></div></div></div>                                        </div></div>
<br>_______________________________________________<br>
geonode-users mailing list<br>
<a href="mailto:geonode-users@lists.osgeo.org">geonode-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/geonode-users" rel="noreferrer" target="_blank">http://lists.osgeo.org/mailman/listinfo/geonode-users</a><br>
<br></blockquote></div><br></div></div></div>
                                          </div></body>
</html>