Flask+Nginx+uWSGI : ImportError: No module named site Flask+Nginx+uWSGI : ImportError: No module named site flask flask

Flask+Nginx+uWSGI : ImportError: No module named site


Here's how I resolved the same error message (ImportError: No module named site) that I got while trying the Django and NGINX tutorial — uWSGI 2.0 documentation.

Deactivate the virtualenv:

deactivate

Install uWSGI system-wide (if not already installed system-wide)

sudo pip install uwsgi

Edit the uwsgi.ini file. I commented out the line with the:

home = /path/to/virtualenv

Run uWSGI --ini mysite_uwsgi.ini.


I read a lot of document about the question, but get no answer.

By coincidentally, I fix this problem by edit uid and gid as root.

It seem like a permissions problem. I don't know why, but it just work. Remember, it is very unsafe to run a product environment as root.


1、active the virtual you used

2、 pip install uwsgi

this the key action,then the

command -v wsgi

show this

/virtual-path/bin/uwsgi

3、use current user to run uwsgi, because other user is not active the virtualenv