Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 834
DataGreed Avatar asked Aug 13 '12 10:08

DataGreed


People also ask

Can I use uWSGI without nginx?

Can I then ditch NGINX? uWSGI could be used as a standalone web server in production, but that is not it's intentional use. It may sound odd, but uWSGI was always supposed to be a go-between a full-featured web server like NGINX and your Python files.

Is Nginx a uWSGI?

Nginx natively includes support for upstream servers speaking the uwsgi protocol since version 0.8.

Is uWSGI a web server?

uWSGI (source code), pronounced "mu wiz gee", is a Web Server Gateway Interface (WSGI) server implementation that is typically used to run Python web applications.


1 Answers

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)

like image 68
Paolo Casciello Avatar answered Oct 11 '22 21:10

Paolo Casciello