Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Following this not so popular question: OpenStack & NGINX+uWSGI

I've start to build my dashboard node using well... NGINX and uWSGI of course, but I'm now facing a path problem.

Indeed, uWSGI is correctly launching the processes and NGINX is correctly connected to it.

BUT, as soon as I try to retrieve the dashboard main page, NGINX is throwing a 503 Error page and my uWSGI Instance yeld me this error message:

ImportError: Could not import settings 'openstack_dashboard.settings' (Is it on sys.path?): No module named openstack_dashboard.settings

This is not the full stack but the revelant part of it.

About me, it's just a matter of PythonPath, but the point is that I don't know how to solve this problem.

Indeed, I now that the PythonPath is an env variable, and I already set one like this on my root user:

export PYTHONPATH='/srv/www/openstack-dashboard/'

Now, my problem is that it seems that this env variable is not detect or not use by python because uWSGI continue to crash with the following complete stack:

Traceback (most recent call last):
   File "/usr/lib/python2.7/dist-packages/django/core/handlers/", line 219, in  __call__
   File "/usr/lib/python2.7/dist-packages/django/core/handlers/", line 39, in load_middleware
   for middleware_path in settings.MIDDLEWARE_CLASSES:
  File "/usr/lib/python2.7/dist-packages/django/utils/", line 184, in inner
  File "/usr/lib/python2.7/dist-packages/django/conf/", line 42, in _setup
self._wrapped = Settings(settings_module)
  File "/usr/lib/python2.7/dist-packages/django/conf/", line 95, in __init__
raise ImportError("Could not import settings '%s' (Is it on sys.path?): %s" % (self.SETTINGS_MODULE, e))

ImportError: Could not import settings 'openstack_dashboard.settings' (Is it on sys.path?): No module named openstack_dashboard.settings

[pid: 31409|app: 0|req: 1/1] () {36 vars in 556 bytes} [Mon Apr  8 11:02:35 2013] GET / => generated 0 bytes in 1 msecs (HTTP/1.1 500) 0 headers in 0 bytes (0 switches on core 0)

So, if anyone has a clue to the way to solve this, I'll be glade to read it ;-)

share|improve this question
up vote 1 down vote accepted

You should invest a bit of time in understanding how the pythonpath works, this is vital for mastering python (and obviously django). For example you added /srv/www/openstack-dashboard/ to your pythonpath (i assume you have set the variable in the right place), so when asking for openstack-dashboard.settings python will search for /srv/www/openstack-dashboard/openstack-dashboard/ In addition to this i suggest you to read the official uWSGI 'WSGI Quickstart', as it reports how to deploy both old and new Django versions.

share|improve this answer
Thank you very much for your help. I've my openStack Dashboard located on: /srv/www/openstack-dashboard/* so, if I correctly understand your explanation and everything I read on the internet regarding PYTHONPATH, my export should look like this: export $PYTHONPATH='/srv/www/' isn't it? If it's right, I'm still facing the same problem with the same message after having correct my path and stop/start my uWSGI server. It seems that python is not using my pythonpath or I'm misconfiguring my path. – Dr I Apr 8 '13 at 12:04
honestly i do not know openstack, but if you want to be sure to add a directory to the pythonpath just add --pythonpath /srv/www to the uwsgi options (you can specify it multiple times to add more directories) – roberto Apr 8 '13 at 12:18
Thank you a lot for your help, I'll check this way :D – Dr I Apr 8 '13 at 12:57

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.