uWSGI and python virtual env
- by user27512
I'm trying to use uWSGI with a virtual env in order to use the Trac bug tracker on it.
I've installed system-wide uwsgi via pip.
Next, I've installed trac in a virtualenv
$ virtualenv venv
$ . venv/bin/activate
$ pip install trac
I've then written a simple uWSGI configuration script:
[uwsgi]
master = true
processes = 1
socket = localhost:3032
home = /srv/http/trac/venv/
no-site = true
gid = www-data
uid = www-data
env = TRAC_ENV=/srv/http/trac/projects/my_project
module = trac.web.main:dispatch_request
But when I try to launch it, it fails:
$ uwsgi --http :8000 --ini /etc/uwsgi/vassals-available/my_project.ini --gid www-data --uid www-data
...
Set PythonHome to /srv/http/trac/venv/
...
*** Operational MODE: single process ***
ImportError: No module named trac.web.main
unable to load app 0 (mountpoint='') (callable not found or import error)
I think uWSGI isn't using the virtual env. When inside the virtual env, I can import trac.web.main without having an ImportError.
How can I do that ?
Thanks