Run Django development server with Gunicorn.
pip install djgunicorn
Then add it to your INSTALLED_APPS. You will get a new command
gunserver (please forgive my little pun-loving self). It runs like
Django’s development server, but the HTTP handling is backed by Gunicorn.
You can find available options with:
python manage.py help gunserver
Most options work as the built-in runserver command (in
- The verbosity and no-color settings are not passed to Gunicorn.
They still affect messages emitted by the command itself, however.
- The nothreading option does not do anything.
- Unit tests and CI.
- Check how low we can support Django and Gunicorn versions.
- Support for additional Gunicorn configs that may be useful. SSL seems to
be a common need.
- Is it possible to conditionally replace the runserver command? By
installing an alternative app config, for example?
- We now use DJANGO_SETTINGS_MODULE to relay where the settings module is
to the Gunicorn subprocess (and let Django loads it automatically). This
causes problems if settings.configure() is called manually without a
module, and will likely require some hacks to fix.
- Add Gunicorn config changing directory to where manage.py to avoid
problems when manage.py is run in another directory.
- Info message is now displayed when Gunicorn reloads, as runserver does.
- Enable extended runserver provided by staticfiles only if it is
installed (which is the default).
- Gunicorn access logs are now coloured, as runserver’s.
- Get rid of a custom static handler in favour of Django’s stock one.
- Gunicorn invocation is re-implemented with subprocess to handle reloading
- Lazy-load WSGI handler in Gunicorn application to avoid race conditions.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.