Adding ASGI support to runserver

  • You run manage.py runserver --asgi and it gives you an error saying you need to install daphne or uvicorn .
  • You install them using pip/poetry/etc.

If it’s a separate package, we can add daphne as a dependency of that package, so the error wouldn’t be required. It would only support daphne to start.

  • manage.py runserver --asgi now just works

:white_check_mark:

  • If you run manage.py runserver (no --asgi ) and Django detects that you have async views, a warning is printed about async views under WSGI (optional, we could instead always just use an ASGI server if one is installed)

The warning is a nice touch.

I think if we want to settle on the separate package approach for now (it can always be merged in the future into the core as asgi matures with django):

  1. Should some of the code from the pr still get merged into django? Adding the get_response_async is required to get static files to work with asgi. get_internal_asgi_application isn’t necessarily required, but it seems like it would be nice to have, and i imagine it would eventually find its way into django.
  2. We can improve the existing app with the warning about async views when running wsgi.
  3. We can make a documentation update to include the a note about the package.

With the above, I think it’ll be a solid improvement!