简体   繁体   English

如何调试Openstack Dashboard?

[英]How can I debug Openstack Dashboard?

I'm running the Openstack Cloud System. 我正在运行Openstack云系统。 I installed and deployed the kilo version on the server successful, but this is only the default version of Openstack. 我在服务器上成功安装并部署了kilo版本,但这只是Openstack的默认版本。 So that, I want to have some modifies on this openstack source and add more features to it. 所以,我希望在这个openstack源上进行一些修改并为其添加更多功能。

I started to change something with the Openstack Dashboard. 我开始用Openstack Dashboard改变一些东西。 However, there are some problems happened. 但是,发生了一些问题。 Therefore, I have debugged this django web application. 因此,我调试了这个django Web应用程序。 All everything I have configured is the same as the official tutorials on the openstack website ( http://docs.openstack.org ). 我配置的所有内容都与openstack网站( 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/ 第一个是/ usr / share / openstack-dashboard /
  • The second one is /usr/lib/python2.7/dist-packages/horizon/ 第二个是/usr/lib/python2.7/dist-packages/horizo​​n/
  • And the config file is /etc/openstack-dashboard/local_settings.py 配置文件是/etc/openstack-dashboard/local_settings.py

I set the option Debug = True in local_settings.py file. 我在local_settings.py文件中设置了Debug = True选项。

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: 但在浏览器中,它显示错误:

错误

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 ! 如何正确调试Openstack Django网站。非常感谢你!

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 当您通过runserver命令运行服务器时,您应该转到127.0.0.1:8000/而不是127.0.0.1:8000/horizo​​n的根URL

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/ 当您安装openstack_dashboard时,有一个apache配置可以监听地址http:// host / horizo​​n查看/ etc / apache2 / conf / sites-available /

The directories 目录

/usr/lib/python2.7/dist-packages/horizon/ /usr/lib/python2.7/dist-packages/horizo​​n/

Is like the framework for all dashboards 就像所有仪表板的框架一样

/usr/share/openstack-dashboard/ 的/ usr /共享/开栈的仪表板/

Is the default dashboard for openstack 是openstack的默认仪表板

/etc/openstack-dashboard/local_settings.py /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 因此,如果您按照该链接http://127.0.0.1:8000/进行调试,您的问题将得到解决

pdb or ide with integrated debugger 带有集成调试器的pdb或ide

Follow this link. 点击此链接。 http://docs.openstack.org/developer/horizon/quickstart.html http://docs.openstack.org/developer/horizo​​n/quickstart.html

Once this is done, add pdb statements to your code that you wish to debug.Go into the horizon folder and run the following command ./run_tests.sh --runserver 127.0.0.1:port_number 完成此操作后,将pdb语句添加到要调试的代码中。进入horizo​​n文件夹并运行以下命令./run_tests.sh --runserver 127.0.0.1:port_number

Instead of local host you can put in the IP address where horizon is running 您可以将地址运行的IP地址放入本地主机,而不是本地主机

I have written the OpenStack documentation for debugging dashboards using PyCharm. 我已经使用PyCharm编写了用于调试仪表板的OpenStack文档。
(It is good for any Openstack Dashboard including Horizon) http://docs.openstack.org/developer/mistral/developer/troubleshooting.html (对包括Horizo​​n在内的任何Openstack Dashboard都有好处) http://docs.openstack.org/developer/mistral/developer/troubleshooting.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM