Ask Your Question
0

ImportError: Could not import settings 'openstack_dashboard.settings'

asked 2013-11-20 14:45:55 -0500

ibenbrahim gravatar image

Hello,

I installed OpenStack, including dashboard on a linux machine following the instructions in http://docs.openstack.org (specifically http://docs.openstack.org/havana/install-guide/install/yum/content/install_dashboard.html (http://docs.openstack.org/havana/inst...) )

But the apache web server doesn’t work properly when I access the “dashboard” component using http://localhost/dashboard . I get “500 Internal Server Error”. And the httpd log indicates: mod_wsgi (pid=34193): Exception occurred processing WSGI script '/usr/share/openstack-dashboard/openstack_dashboard/wsgi/django.wsgi . . . File "/usr/lib/python2.6/site-packages/django/conf/__init__.py", line 95, in __init__ ImportError: Could not import settings 'openstack_dashboard.settings' (Is it on sys.path?)

The file django.wsi has: sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), '../..')) os.environ['DJANGO_SETTINGS_MODULE'] = 'openstack_dashboard.settings' Also There is a file /usr/share/openstack-dashboard/openstack_dashboard/settings.py and a file __init__.py so I’m not sure why it is complaining…

Currently my /etc/openstack-dashboard/ directory has 3 files: keystone_policy.json local_settings nova_policy.json And my directory /usr/share/openstack-dashboard has 5 files: manage.py manage.pyc manage.pyo openstack_dashboard static Directory /usr/share/openstack-dashboard/openstack_dashboard has several files including settings.py, settings.pyc, settings.pyo, __init__.py ...

Thanks for the help

11/20/2013 11am addition: I am using a RedHat 6.4 machine and I followed the instructions in http://docs.openstack.org/havana/install-guide/install/yum/content/install_dashboard.html (http://docs.openstack.org/havana/inst...) to install dashboard. I installed keystone, glance and nova using yum. I already have ALLOWED_HOSTS=['10.160.20.161', 'localhost'] in /etc/openstack-dashboard/local_settings Here is what I see in /var/log/httpd/error_log :

[Wed Nov 20 11:16:33 2013] [error] [client ::1] mod_wsgi (pid=37278): Exception occurred processing WSGI script '/usr/share/openstack-dashboard/openstack_dashboard/wsgi/django.wsgi'. [Wed Nov 20 11:16:33 2013] [error] [client ::1] Traceback (most recent call last): [Wed Nov 20 11:16:33 2013] [error] [client ::1] File "/usr/lib/python2.6/site-packages/django/core/handlers/wsgi.py", line 219, in __call__ [Wed Nov 20 11:16:33 2013] [error] [client ::1] self.load_middleware() [Wed Nov 20 11:16:33 2013] [error] [client ::1] File "/usr/lib/python2.6/site-packages/django/core/handlers/base.py", line 39, in load_middleware [Wed Nov 20 11:16:33 2013] [error] [client ::1] for middleware_path in settings.MIDDLEWARE_CLASSES: [Wed Nov 20 11:16:33 2013] [error] [client ::1] File "/usr/lib/python2.6/site-packages/django/utils/functional.py", line 184, in inner [Wed Nov 20 11:16:33 2013] [error] [client ::1] self._setup() [Wed Nov 20 11:16:33 2013] [error] [client ::1] File "/usr/lib/python2.6/site-packages/django/conf/__init__.py", line 42, in _setup [Wed Nov 20 11:16:33 2013] [error] [client ::1] self._wrapped = Settings(settings_module) [Wed Nov 20 11:16:33 2013] [error] [client ::1] File "/usr/lib/python2.6/site-packages/django/conf/__init__.py", line 95, in __init__ [Wed Nov 20 11:16:33 2013] [error ... (more)

edit retag flag offensive close merge delete

8 answers

Sort by » oldest newest most voted
0

answered 2013-11-20 15:02:13 -0500

mrunge gravatar image

There is a common issue with ALLOWED_HOSTS setting. Please be sure to include localhost in the list as well.

If that doesn't solve your issue, please provide more info: version you're using, where did you get the files etc....

More logs would be great, too!

edit flag offensive delete link more

Comments

i am installing devstack juno release on ubuntu 14.04 64bit and getting similar import error but not resolved by the above solution. here is link need help link text

mohsin gravatar imagemohsin ( 2015-04-01 02:31:04 -0500 )edit
0

answered 2013-12-04 01:41:44 -0500

avladu gravatar image

pip install pbr solved my problem also.

edit flag offensive delete link more
0

answered 2013-11-20 17:01:07 -0500

ibenbrahim gravatar image

Please see the addition titled " 11/20/2013 11am addition:" in the question.

Imad Benbrahim

-----Original Message----- From: bounces@canonical.com [mailto:bounces@canonical.com] On Behalf Of Matthias Runge Sent: Wednesday, November 20, 2013 10:06 AM To: Benbrahim, Imad Subject: Re: [Question #239533]: ImportError: Could not import settings 'openstack_dashboard.settings'

Your question #239533 on OpenStack Dashboard (Horizon) changed: https://answers.launchpad.net/horizon/+question/239533 (https://answers.launchpad.net/horizon...)

Status: Open => Answered

Matthias Runge proposed the following answer: There is a common issue with ALLOWED_HOSTS setting. Please be sure to include localhost in the list as well.

If that doesn't solve your issue, please provide more info: version you're using, where did you get the files etc....

More logs would be great, too!


If this answers your question, please go to the following page to let us know that it is solved: https://answers.launchpad.net/horizon/+question/239533/+confirm?answer_id=0 (https://answers.launchpad.net/horizon...)

If you still need help, you can reply to this email or go to the following page to enter your feedback: https://answers.launchpad.net/horizon/+question/239533 (https://answers.launchpad.net/horizon...)

You received this question notification because you asked the question.

edit flag offensive delete link more
0

answered 2013-11-21 16:35:37 -0500

ibenbrahim gravatar image

Thanks Matthias Runge, that solved my question.

edit flag offensive delete link more
0

answered 2013-11-21 16:35:09 -0500

ibenbrahim gravatar image

I disabled SELinux and rebooted and I no longer have the autentication issue. While this might not be my fnal solution, I can make progress now.

edit flag offensive delete link more
0

answered 2013-11-20 21:19:33 -0500

ibenbrahim gravatar image

Thank very much! yum install python-pbr followed by service httpd restart solved this problem.

But when I try to login I get an authentication error. In the browser I get "An error occurred authenticating. Please try again later." and in the logs: /var/log/httpd/error_log: [Wed Nov 20 21:00:52 2013] [error] REQ: curl -i -X POST http://localhost:5000/v2.0/tokens -H "Content-Type: application/json" -H "User-Agent: python-keystoneclient" [Wed Nov 20 21:00:52 2013] [error] REQ BODY: {"auth": {"passwordCredentials": {"username": "admin", "password": "admin"}}} [Wed Nov 20 21:00:52 2013] [error] [Wed Nov 20 21:00:52 2013] [error] INFO:urllib3.connectionpool:Starting new HTTP connection (1): localhost [Wed Nov 20 21:00:52 2013] [error] Login failed for user "admin".

/var/log/access_log: 127.0.0.1 - - [20/Nov/2013:16:10:25 -0500] "POST /dashboard/auth/login/ HTTP/1.1" 200 1700 "http://localhost/dashboard/auth/login/" "Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20131023 Firefox/17.0" 127.0.0.1 - - [20/Nov/2013:16:10:26 -0500] "GET /dashboard/i18n/js/horizon/ HTTP/1.1" 200 718 "http://localhost/dashboard/auth/login/" "Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20131023 Firefox/17.0

keystone.log remains unchanged.

My /etc/openstack-dashboard/local_settings : import os from django.utils.translation import ugettext_lazy as _ from openstack_dashboard import exceptions DEBUG = True TEMPLATE_DEBUG = DEBUG ALLOWED_HOSTS = ['10.160.20.161', 'localhost'] HORIZON_CONFIG = { 'dashboards': ('project', 'admin', 'settings',), 'default_dashboard': 'project', 'user_home': 'openstack_dashboard.views.get_user_home', 'ajax_queue_limit': 10, 'auto_fade_alerts': { 'delay': 3000, 'fade_duration': 1500, 'types': ['alert-success', 'alert-info'] }, 'help_url': "http://docs.openstack.org", 'exceptions': {'recoverable': exceptions.RECOVERABLE, 'not_found': exceptions.NOT_FOUND, 'unauthorized': exceptions.UNAUTHORIZED}, } from horizon.utils import secret_key LOCAL_PATH = '/var/lib/openstack-dashboard' SECRET_KEY = secret_key.generate_or_read_from_file(os.path.join(LOCAL_PATH, '.secret_key_store')) SESSION_ENGINE = 'django.contrib.sessions.backends.cache' CACHES = { 'default': { 'BACKEND' : 'django.core.cache.backends.locmem.LocMemCache' } } EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'

OPENSTACK_HOST = "localhost" OPENSTACK_KEYSTONE_URL = "http://%s:5000/v2.0" % OPENSTACK_HOST OPENSTACK_KEYSTONE_DEFAULT_ROLE = "admin" OPENSTACK_KEYSTONE_BACKEND = { 'name': 'native', 'can_edit_user': True, 'can_edit_group': True, 'can_edit_project': True, 'can_edit_domain': True, 'can_edit_role': True }

OPENSTACK_HYPERVISOR_FEATURES = { 'can_set_mount_point': False,

# NOTE: as of Grizzly this is not yet supported in Nova so enabling this
# setting will not do anything useful
'can_encrypt_volumes': False

} OPENSTACK_NEUTRON_NETWORK = { 'enable_lb': False, 'enable_firewall': False, 'enable_quotas': True, 'enable_vpn': False, # The profile_support option is used to detect if an external router can be # configured via the dashboard. When using specific plugins the # profile_support can be turned on if needed. 'profile_support': None, #'profile_support': 'cisco', } API_RESULT_LIMIT = 1000 API_RESULT_PAGE_SIZE = 20 TIME_ZONE = "UTC" POLICY_FILES_PATH = '/etc/openstack-dashboard' POLICY_FILES = { 'identity': 'keystone_policy.json', 'compute': 'nova_policy.json' }

edit flag offensive delete link more
0

answered 2013-11-20 19:12:47 -0500

mrunge gravatar image

ok, now that we have the full log: yum install python-pbr && service httpd restart

Please note, your httpd seems to listen on ipv6. IPv6 is unsupported on OpenStack.

edit flag offensive delete link more
0

answered 2013-12-04 07:44:10 -0500

mrunge gravatar image

In a distribution you never should use pip install, because pip installed packages won't see any updates through the distribution.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2013-11-20 14:45:55 -0500

Seen: 2,601 times

Last updated: Dec 04 '13