Search code examples
pythondjangodebuggingopenstackopenstack-horizon

How can I debug Openstack Dashboard?


I'm running the Openstack Cloud System. I installed and deployed the kilo version on the server successful, but this is only the default version of Openstack. So that, I want to have some modifies on this openstack source and add more features to it.

I started to change something with the Openstack Dashboard. However, there are some problems happened. Therefore, I have debugged this django web application. All everything I have configured is the same as the official tutorials on the openstack website (http://docs.openstack.org).

So, I have search on my server and find out 2 places that have the sources:

  • The first one is /usr/share/openstack-dashboard/
  • The second one is /usr/lib/python2.7/dist-packages/horizon/
  • And the config file is /etc/openstack-dashboard/local_settings.py

I set the option Debug = True in local_settings.py file.

On the server I typed these commands:

cd /usr/share/openstack-dashboard/
python manage.py runserver

Here is the output:

RemovedInDjango18Warning: XViewMiddleware has been moved to django.contrib.admindocs.middleware.
WARNING:py.warnings:RemovedInDjango18Warning: XViewMiddleware has been moved to django.contrib.admindocs.middleware.
RemovedInDjango18Warning: XViewMiddleware has been moved to django.contrib.admindocs.middleware.
WARNING:py.warnings:RemovedInDjango18Warning: XViewMiddleware has been moved to django.contrib.admindocs.middleware.
Performing system checks...

System check identified no issues (0 silenced).
August 05, 2015 - 09:28:50
Django version 1.7.6, using settings 'openstack_dashboard.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.

But in the browser, it shows the error:

error

And then, on the console, it shows:

Starting development server at http://127.0.0.1:8000/                                                                                                                                                                                                                          
Quit the server with CONTROL-C.                                                                                                                                                                                                                                                
[05/Aug/2015 10:21:29] "GET / HTTP/1.1" 302 0                                                                                                                                                                                                                                  
Not Found: /horizon/auth/login/                                                                                                                                                                                                                                                
[05/Aug/2015 10:21:29] "GET /horizon/auth/login/?next=/ HTTP/1.1" 404 4237                                                                                                                                                                                                     
Not Found: /favicon.ico                                                                                                                                                                                                                                                        
[05/Aug/2015 10:21:29] "GET /favicon.ico HTTP/1.1" 404 4206  

Please help me to get out of this problems. And how can to debug Openstack Django Website properly.Thank you very much !


Solution

  • As you run server by runserver command you should go to the root url like 127.0.0.1:8000/ not 127.0.0.1:8000/horizon

    The difference is in running method. When you installed openstack_dashboard there is apache config that listen to address http://host/horizon look in to /etc/apache2/conf/sites-available/

    The directories

    /usr/lib/python2.7/dist-packages/horizon/

    Is like the framework for all dashboards

    /usr/share/openstack-dashboard/

    Is the default dashboard for openstack

    /etc/openstack-dashboard/local_settings.py

    The config file for dashboard. Here you can apply changes for default dash, for example attach your project that modifies or extends default dash

    So, your problem will be solved if you follow that link http://127.0.0.1:8000/ For debugging use

    pdb or ide with integrated debugger