Using Virtualenv
To serve an app from a Virtualenv it is generally easiest to just install Gunicorn directly into the Virtualenv. This will create a set of Gunicorn scripts for that Virtualenv which can be used to run applications normally.
If you have Virtualenv installed, you should be able to do something like this:
$ mkdir ~/venvs/
$ virtualenv ~/venvs/webapp
$ source ~/venvs/webapp/bin/activate
$ pip install gunicorn
$ deactivate
Then you just need to use one of the three Gunicorn scripts that was installed into ~/venvs/webapp/bin
.
Note: You can force the installation of Gunicorn in your Virtualenv by passing -I
or --ignore-installed
option to pip:
$ source ~/venvs/webapp/bin/activate
$ pip install -I gunicorn