How do I run uwsgi with virtualenv
Use -H
to set virtualenv to python path.
uwsgi -H /path/to/your/virtualenv
http://uwsgi-docs.readthedocs.org/en/latest/Options.html#virtualenv
To use the activated virtualenv you can use this config snippet in your uwsgi.ini
:
; If VIRTUAL_ENV is set then use its value to specify the virtualenv directoryif-env = VIRTUAL_ENVvirtualenv = %(_)endif =
As user995394 pointed out, there is a way to tell uWSGI use existing virtual environment.However, when I pass uWSGI option in form virtualenv = /full/path/to/my/virtualenv
(it's from INI config) it complains about ImportError: No module named site
. The workaround I found is that you launch uWSGI from folder where your virtualenv is and pass just virtualenv = my_virtualenv_name
(i.e. path is relative).
I use uWSGI 2.0.