Gunicorn 0.5 introduced the ability to use a Python configuration file. Gunicorn will look for gunicorn.conf.py in the current working directory or what ever path is specified on the command line with the -c option.
backlog = 2048 # The listen queue size for the server socket
bind = "127.0.0.1:8000" # Or "unix:/tmp/gunicorn.sock"
daemon = False # Whether work in the background
debug = False # Some extra logging
keepalive = 2 # Time we wait for next connection (in seconds)
logfile = "-" # Name of the log file
loglevel = "info" # The level at which to log
pidfile = None # Path to a PID file
workers = 1 # Number of workers to initialize
umask = 0 # Umask to set when daemonizing
user = None # Change process owner to user
group = None # Change process group to group
proc_name = None # Change the process name
spew=False # Display trace
timeout=30 # Worker timeout
tmp_upload_dir = None # Set path used to store temporary uploads
worker_class = "egg:gunicorn#sync" # The type of request processing to use
worker_connections=1000 # Maximum number of simultaneous connections
after_fork=lambda server, worker: server.log.info(
"Worker spawned (pid: %s)" % worker.pid)
before_fork=lambda server, worker: True
before_exec=lambda server: server.log.info("Forked child, reexecuting")
when_ready=lambda server: server.log.info("Gunicorn started.")
Define the type of worker to use. A worker process all the requests send by the arbiter.By default the worker_class is egg:gunicorn#sync. This worker only supports fast request handling requiring a buffering HTTP proxy.
If your application requires the ability to handle prolonged requests to provide long polling, comet, or calling an external web service you'll need to use an async worker. Gunicorn has three async workers built in using Tornado, Eventlet or Gevent. You can also use the Evenlet worker with the Twisted helper.