1. ===============================
    
  2. How to use Django with Gunicorn
    
  3. ===============================
    
  4. 
    
  5. .. highlight:: bash
    
  6. 
    
  7. Gunicorn_ ('Green Unicorn') is a pure-Python WSGI server for UNIX. It has no
    
  8. dependencies and can be installed using ``pip``.
    
  9. 
    
  10. .. _Gunicorn: https://gunicorn.org/
    
  11. 
    
  12. Installing Gunicorn
    
  13. ===================
    
  14. 
    
  15. Install gunicorn by running ``python -m pip install gunicorn``. For more
    
  16. details, see the `gunicorn documentation`_.
    
  17. 
    
  18. .. _gunicorn documentation: https://docs.gunicorn.org/en/latest/install.html
    
  19. 
    
  20. Running Django in Gunicorn as a generic WSGI application
    
  21. ========================================================
    
  22. 
    
  23. When Gunicorn is installed, a ``gunicorn`` command is available which starts
    
  24. the Gunicorn server process. The simplest invocation of gunicorn is to pass the
    
  25. location of a module containing a WSGI application object named
    
  26. ``application``, which for a typical Django project would look like::
    
  27. 
    
  28.     gunicorn myproject.wsgi
    
  29. 
    
  30. This will start one process running one thread listening on ``127.0.0.1:8000``.
    
  31. It requires that your project be on the Python path; the simplest way to ensure
    
  32. that is to run this command from the same directory as your ``manage.py`` file.
    
  33. 
    
  34. See Gunicorn's `deployment documentation`_ for additional tips.
    
  35. 
    
  36. .. _deployment documentation: https://docs.gunicorn.org/en/latest/deploy.html