1. ================================
    
  2. How to use Django with Hypercorn
    
  3. ================================
    
  4. 
    
  5. .. highlight:: bash
    
  6. 
    
  7. Hypercorn_ is an ASGI server that supports HTTP/1, HTTP/2, and HTTP/3
    
  8. with an emphasis on protocol support.
    
  9. 
    
  10. Installing Hypercorn
    
  11. ====================
    
  12. 
    
  13. You can install Hypercorn with ``pip``::
    
  14. 
    
  15.     python -m pip install hypercorn
    
  16. 
    
  17. Running Django in Hypercorn
    
  18. ===========================
    
  19. 
    
  20. When Hypercorn is installed, a ``hypercorn`` command is available
    
  21. which runs ASGI applications. Hypercorn needs to be called with the
    
  22. location of a module containing an ASGI application object, followed
    
  23. by what the application is called (separated by a colon).
    
  24. 
    
  25. For a typical Django project, invoking Hypercorn would look like::
    
  26. 
    
  27.     hypercorn myproject.asgi:application
    
  28. 
    
  29. This will start one process listening on ``127.0.0.1:8000``. It
    
  30. requires that your project be on the Python path; to ensure that run
    
  31. this command from the same directory as your ``manage.py`` file.
    
  32. 
    
  33. For more advanced usage, please read the `Hypercorn documentation
    
  34. <Hypercorn_>`_.
    
  35. 
    
  36. .. _Hypercorn: https://pgjones.gitlab.io/hypercorn/