Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
80 lines (53 sloc) 2.83 KB


Control your gunicorn process with fabric.


The installation is thanks to the Python Package Index and pip really simple.

$ pip install fabric-gunicorn

First steeps

Add import fabric_gunicorn as gunicorn to your new or existing After this you should go in your termianl and run fab -l in your project directory. You will see something like this:

Available commands:

gunicorn.add_worker     Increase the number of your gunicorn workers
gunicorn.reload         Reload gracefully the gunicorn process and the wsgi application
gunicorn.remove_worker  Decrease the number of your gunicorn workers
gunicorn.restart        Restart hard the gunicorn process
gunicorn.start          Start the gunicorn process
gunicorn.status         Show the current status of your gunicorn process
gunicorn.stop           Stop the gunicorn process

Befor you can start a gunicorn process on your server you must set the gunicorn_wsgi_app env variable. Edit your and add something like: env.gunicorn_wsgi_app = 'hello.wsgi:app'. The default workdir is the home directory of the connected user. You can also change this path with the env variable env.remote_workdir.

Normaly you should now able to run fab gunicorn.start and the gunicorn server should start on your remote machine. Gunicorn must be installed. Your wsgi app is now avaiable under


fabric-gunicorn take all configuration from the fabric env variable. For gunicorn I added some variables:

This is normaly your project path.
If you want to use a virtualenv than you can here define the path to your env directory.
There you set your wsgi app import path. Example: mydjangoproject.wsgi:application
Define on which port or socket gunicorn should bind. Default:
The path for the pidfile of the gunicorn master process. Default: remote_workdir/
The number of gunicorn worker processes by start. Default: 1
The class of worker you want to use. Normal the default sync worker should run fine. More under:
This is special for django to set the DJANGO_SETTINGS_MODULE path. Example: mydjangoproject.settings
This should point to your application.ini paster deploy settings file. Setting this will cause gunicorn to execute using gunicorn_paster instead of gunicorn. Example: config/application.ini