DataGreed
DataGreed

Reputation: 13899

Can't start uWSGI server without virtualenv (ImportError)

I'm running django+nginx+uwsgi. For some reason I cannot start uWSGI without setting home option, pointing to virtual environment. Whenever I start uWSGI without it, it says that it cannot find module django.core.wsgi, like if python path was empty (but django 1.4 is installed system-wide).

How can i fix it?

Upvotes: 6

Views: 6238

Answers (1)

Paolo Casciello
Paolo Casciello

Reputation: 8202

Since I hit my head on this problem too, let's write an answer for all. :) The problem is that, when starting in emperor mode (system wide), the uwsgi master process can't (or won't) load the correct environ for python (PYTHONPATH). Using virtualenv you specify the environ. Without it you need to set the pythonpath variable, even multiple times pointing to the system-wide python paths.

Just as an example, for my system it's:

pythonpath = /usr/local/lib/python2.7/dist-packages
pythonpath = /usr/lib/python2.7

(using the ini syntax)

Upvotes: 18

Related Questions