uWSGI and python virtual env
Posted
by
user27512
on Server Fault
See other posts from Server Fault
or by user27512
Published on 2014-04-28T07:51:11Z
Indexed on
2014/05/29
9:30 UTC
Read the original article
Hit count: 235
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
© Server Fault or respective owner