(Other posts on SO are similar, but none have the specific combination of uwsgi + Flask + virtualenv) (This one is closest)
I installed uwsgi via apt-get. I also tried pip install wsgi. Both gave me the same issue.
Test command:
sudo uwsgi -s /tmp/uwsgi.sock -w myapp:app -H myvirtualenv
Result:
Python version: 2.7.4 (default, Apr 19, 2013, 18:35:44) [GCC 4.7.3]
Set PythonHome to myvirtualenv
ImportError: No module named site
I can otherwise run my app in the virtual env.
The path to your virtual environment is wrong. That's the reason for this error.
I'm using virtualenvwrapper and my virtual environments are set at ~/.virtualenvs. So in my case, the uwsgi call would look something like
sudo uwsgi -s /tmp/uwsgi.sock -w myapp:app -H ~/.virtualenvs/myapp
Hope this helps next time someone comes looking for this one.
Thanks to Cody for pointing it out in the comments.