$ sudo easy_install virtualenv $ mkdir ~/environments/ $ virtualenv ~/environments/tutorial/ $ cd ~/environments/tutorial/ $ ls bin include lib $ source bin/activate (tutorial) $ ./bin/easy_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)
Gunicorn 'Green Unicorn' is a Python WSGI HTTP Server for UNIX. It's a pre-fork worker model ported from Ruby's Unicorn project. The Gunicorn server is broadly compatible with various web frameworks, simply implemented, light on server resources, and fairly speedy.