Gunicorn init script
Shell Python
Switch branches/tags
Nothing to show
Clone or download
spack971 Merge pull request #2 from goncalopp/master
I'll merge it as is for now. Thanks for your contribution.
Latest commit 8aa5bee Apr 25, 2015
Failed to load latest commit information.
tree/etc example.conf: generic virtualenv path Feb 14, 2014
LICENSE First commit. Apr 1, 2011
README support for running as another user Jan 2, 2014 First commit. Apr 1, 2011


This project provides an init script for the Gunicorn project.

You can run multiple python web application by setting multiple configuration files.

Basic Usage

You will find in the tree directory an example of how to use this script.

For instance, each file in the CONF_DIR directory (/etc/gunicorn by default) represents a web application. For each configuration file, the PID of the master Gunicorn process is stored in /var/run/gunicorn/<conf>.pid, and logs are printed to /var/log/gunicorn/<conf>.log.

Script configuration

The script configuration file is /etc/default/gunicorn. You have the following variables to set:

  • RUN <yes|no>, should the script run on system boot ?
  • CONF_DIR, where are the web application configuration files ?
  • CONFIGS, which configuration file(s) to load ?
  • USE_VIRTUALENVS, which configuration file(s) to load ?
  • RUN_USER, the user to run the gunicorn process

Web application configuration

For the web application configuration file, you have these possible variables:

  • WORKING_DIR, the script will change to this directory before launching Gunicorn.
  • APP_MODULE, Python module and callable to run.
  • CONFIG_FILE, Python Gunicorn configuration file path.
  • LOG_LEVEL, logging level.
  • VIRTUALENV, path to the app virtualenv.

Init script

These are the different actions allowed by the init script:

  • start, starts all defined configuration files. The RUN variable must be set to yes.

  • stop, stops all defined configuration files.

  • restart, restarts all defined configuration files.

  • reload, reloads (kill -HUP) all defined configuration files.

  • start_one <conf>, starts the given configuration file.

  • stop_one <conf>, stops the given configuration file.

  • reload_one <conf>, reloads the given configuration file.

  • inc <conf>, increase workers for the given configuration file.

  • dec <conf>, decrease workers for the given configuration file.


gunicorn-init is released under the MIT License. See the LICENSE file for details.