Django Running Django application with Gunicorn


Example

  1. Install gunicorn

    pip install gunicorn

  1. From django project folder (same folder where manage.py resides), run the following command to run current django project with gunicorn

    gunicorn [projectname].wsgi:application -b 127.0.0.1:[port number]

    You can use the --env option to set the path to load the settings

    gunicorn --env DJANGO_SETTINGS_MODULE=[projectname].settings [projectname].wsgi

    or run as daemon process using -D option

  1. Upon successful start of gunicorn, the following lines will appear in console

    Starting gunicorn 19.5.0

    Listening at: http://127.0.0.1:[port number] ([pid])

    .... (other additional information about gunicorn server)