简体   繁体   中英

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?

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM