Latest version: 19.1

Installation

Here's a quick rundown on how to get started with gunicorn. For more detail read the documentation.

  $ sudo pip install virtualenv
  $ mkdir ~/environments/
  $ virtualenv ~/environments/tutorial/
  $ cd ~/environments/tutorial/
  $ ls
  bin  include  lib
  $ source bin/activate
  (tutorial) $ pip install gunicorn
  (tutorial) $ mkdir myapp
  (tutorial) $ cd myapp/
  (tutorial) $ vi myapp.py
  (tutorial) $ cat myapp.py

  def app(environ, start_response):
      data = "Hello, World!\n"
      start_response("200 OK", [
          ("Content-Type", "text/plain"),
          ("Content-Length", str(len(data)))
      ])
      return iter([data])

  (tutorial) $ ../bin/gunicorn -w 4 myapp:app
  2010-06-05 23:27:07 [16800] [INFO] Arbiter booted
  2010-06-05 23:27:07 [16800] [INFO] Listening at: http://127.0.0.1:8000
  2010-06-05 23:27:07 [16801] [INFO] Worker spawned (pid: 16801)
  2010-06-05 23:27:07 [16802] [INFO] Worker spawned (pid: 16802)
  2010-06-05 23:27:07 [16803] [INFO] Worker spawned (pid: 16803)
  2010-06-05 23:27:07 [16804] [INFO] Worker spawned (pid: 16804)

Deployment

Gunicorn is wsgi http server. It is best to use Gunicorn behind HTTP proxy server. We strongly advise you to use nginx.

Here's an example to help you get started with using nginx.

  server {
    listen 80;
    server_name example.org;
    access_log  /var/log/nginx/example.log;

    location / {
        proxy_pass http://127.0.0.1:8000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
  }

Nginx is set up as reverse proxy server to gunicorn server which is running at localhost port 8000.

Read the full documentation at docs.gunicorn.org

Mailing list

The user mailing list is general discussion and support list for Gunicorn users.

The archive for this list can also be browsed online.

Irc

The Gunicorn channel is on the Freenode IRC network. You can chat with other on #gunicorn channel.

Issue Tracking

Bug reports, enhancement requests and tasks generally go in the Github issue tracker.

Documentation

You can read more comprehensive documentation at docs.gunicorn.org.

The contents are: