What IS Gunicorn
Short introduction to Gunicorn
​Gunicorn 'Green Unicorn' is a Python WSGI HTTP Server for UNIX. It's a pre-fork worker model. The Gunicorn server is broadly compatible with various web frameworks, simply implemented, light on server resources, and fairly speedy.
Gunicorn is one of many WSGI server implementations, but it's particularly important because it is a stable, commonly-used part of web app deployments that's powered some of the largest Python-powered web applications in the world, such as Instagram.
Gunicorn is based on a pre-fork worker model, compared to a worker model architecture. The pre-work worker model means that a master thread spins up workers to handle requests but otherwise does not control how those workers perform the request handling. Each worker is independent of the controller.
​

Gunicorn Features

    Natively supports WSGI, Django, and Paster
    Automatic worker process management
    Simple Python configuration
    Multiple worker configurations
    Various server hooks for extensibility
    Compatible with Python 3.x >= 3.4
​

Gunicorn Installation

Requirements: Python 3.x >= 3.4
To install the latest released version of Gunicorn
1
$ pip install gunicorn
Copied!
From sources
1
$ pip install git+https://github.com/benoitc/gunicorn.git
Copied!

​

Basic Setup Sample

1
$ pip install gunicorn
2
$ cat myapp.py
3
def app(environ, start_response):
4
data = b"Hello, World!\n"
5
start_response("200 OK", [
6
("Content-Type", "text/plain"),
7
("Content-Length", str(len(data)))
8
])
9
return iter([data])
10
$ gunicorn -w 4 myapp:app
Copied!

​

Resources

    ​Gunicorn - the official website
    ​Gunicorn Docs - for the last stable version
    ​Gunicorn - blog article published on Full-Stack Python
Last modified 5mo ago