Deploy with Gunicorn

Gunicorn is a WSGI HTTP server for UNIX. It’s popular with people looking for something more lightweight – and potentially more performant – than Apache, since it primarily works hand in hand with Nginx. It will, however, require a bit more configuration work.

Using Gunicorn usually starts with running the Gunicorn server, pointing it to your WSGI application. Although you can write a quick WSGI script to get one pointing to your website root, there’s a nice shortcut in the form of thepiecrust.wsgiutil.cwdapp module. It will automatically create a WSGI application for the current directory.

So you can easily run Gunicorn without writing anything:

cd /path/to/website/rootdir
gunicorn piecrust.wsgiutil.cwdapp:app

Of course, you may want to use custom command-line parameters – see the documentation on running Gunicorn for more information.

After that, you can configure Nginx (or any other web server that can do HTTP proxying) to handle requests and responses. See the documentation on deploying Gunicorn for more information on that.