无法安装 OpenStack 仪表板

无法安装 OpenStack 仪表板

我正在尝试按照 OpenStack 的官方文档安装云。当我尝试在云控制器上安装仪表板时:http://docs.openstack.org/diablo/openstack-compute/install/content/configure-dashboard.html尝试同步数据库时出现错误:

$ /usr/share/openstack-dashboard/dashboard/manage.py syncdb

ERROR:root:No module named local.local_settings
Traceback (most recent call last):
  File "/usr/share/openstack-dashboard/dashboard/settings.py", line 117, in <module>
    from local.local_settings import *
ImportError: No module named local.local_settings
ERROR:root:No module named local.local_settings
Traceback (most recent call last):
  File "/usr/share/openstack-dashboard/dashboard/../dashboard/settings.py", line 117, in <module>
    from local.local_settings import *
ImportError: No module named local.local_settings
Traceback (most recent call last):
  File "./dashboard/manage.py", line 31, in <module>
    execute_manager(settings)
  File "/usr/lib/pymodules/python2.7/django/core/management/__init__.py", line 438, in execute_manager
    utility.execute()
  File "/usr/lib/pymodules/python2.7/django/core/management/__init__.py", line 379, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/lib/pymodules/python2.7/django/core/management/base.py", line 191, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/usr/lib/pymodules/python2.7/django/core/management/base.py", line 220, in execute
    output = self.handle(*args, **options)
  File "/usr/lib/pymodules/python2.7/django/core/management/base.py", line 351, in handle
    return self.handle_noargs(**options)
  File "/usr/lib/pymodules/python2.7/django/core/management/commands/syncdb.py", line 56, in handle_noargs
    cursor = connection.cursor()
  File "/usr/lib/pymodules/python2.7/django/db/backends/dummy/base.py", line 15, in complain
    raise ImproperlyConfigured("You haven't set the database ENGINE setting yet.")
django.core.exceptions.ImproperlyConfigured: You haven't set the database ENGINE setting yet.

我的 /usr/share/openstack-dashboard/local/local_settings.py 与指南中的相同。我安装了 python-mysqldb,但我没有更改。

然后我尝试从 git 安装 Dashboard,就像在 wiki 中一样:http://wiki.openstack.org/OpenStackDashboard 但我犯了同样的错误。

我使用 VirtualBox 安装 2 台服务器,每台服务器运行 Ubuntu server 11.10 amd64。除了仪表板之外,一切都很好!

我该如何修复它?谢谢!

答案1

看起来 python 找不到 local.local_settings.py,这对我来说看起来很正常。

您位于:

/usr/share/openstack-dashboard/dashboard/

您的 local_settings.py 位于:

/usr/share/openstack-dashboard/local/local_settings.py

import local.local_settings.py 将在 /usr/share/openstack-dashboard/dashboard/local/local_settings.py 中查找它

在里面gitopenstack-dashboard 中有一个小型包装器可以帮助解决这个问题。只需在 openstack-dashboard 中创建一个新文件,将其命名为 manage.py,复制以下代码:

#!/usr/bin/env python
import os, sys

if __name__ == "__main__":
    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dashboard.settings")

    from django.core.management import execute_from_command_line

    execute_from_command_line(sys.argv)

现在执行它。

该代码的作用是改变全局变量,以便 django 的默认 settings.py 现在是 dashab/settings.py(而不是 ./settings.py),并调用默认的 django manage.py。

这应该可以解决导入错误,因为现在 local/local_settings.py 已经存在。当然,这可能会造成另一个导入问题,但值得一试。

相关内容