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:

  1. $ mkdir ~/venvs/
  2. $ virtualenv ~/venvs/webapp
  3. $ source ~/venvs/webapp/bin/activate
  4. $ pip install gunicorn
  5. $ 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:

  1. $ source ~/venvs/webapp/bin/activate
  2. $ pip install -I gunicorn