我正在使用 Openstack Liberty 和 Ubuntu 14.04。安装 openstack dashboard 后,一切正常,然后我决定卸载并重新安装 openstack dashboard 包,因为一位同事错误地配置了 SSL 并更改了仪表板主题以对其进行自定义。现在,我收到以下错误。
mod_wsgi (pid=30567, process='horizon', application='cpph-ch01-blade02|/horizon'): Loading WSGI script '/usr/share/openstack-dashboard/openstack_dashboard/wsgi/django.wsgi'.
sys.path is: ['/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PILcompat', '/usr/lib/python2.7/dist-packages/gst-0.10', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/python2.7/dist-packages/ubuntu-sso-client']
Target WSGI script '/usr/share/openstack-dashboard/openstack_dashboard/wsgi/django.wsgi' cannot be loaded as Python module.
Exception occurred processing WSGI script '/usr/share/openstack-dashboard/openstack_dashboard/wsgi/django.wsgi'.
Traceback (most recent call last):
[:error] [pid 30567:tid 140400988059392] File "/usr/share/openstack-dashboard/openstack_dashboard/wsgi/django.wsgi", line 8, in <module>
[:error] [pid 30567:tid 140400988059392] from django.core.wsgi import get_wsgi_application
[:error] [pid 30567:tid 140400988059392] ImportError: No module named django.core.wsgi
在下面显示的目标脚本中,我打印了 syspath 。不确定这是否重要,但我在 /usr/local/lib/python2.7/dist-packages/django/core/wsgi.py 有目标 wsgi 脚本
1 import logging
2 import os
3 import sys
4 # print
5 print >>sys.stderr, "sys.path is: " + str(sys.path)
6 from django.core.wsgi import get_wsgi_application
7 from django.conf import settings
8 # Add this file path to sys.path in order to import settings
9 sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), '../..'))
10 os.environ['DJANGO_SETTINGS_MODULE'] = 'openstack_dashboard.settings'
11 sys.stdout = sys.stderr
12 sys.path.append("/usr/share/openstack-dashboard/")
13 application = get_wsgi_application()
我已尝试多次重新安装它无济于事,我无法重新安装 python,因为这是一个生产环境。目前,我已经在不同的主机上安装了仪表板并将其连接到我的生产服务器作为解决方法。
我不是 python 开发人员,也没有使用虚拟环境或任何与开发相关的东西,这是一个简单的 apt-get 安装。