Updated to work with gunicorn