This thread is continuing conversations started here.
I have a little asgi runserver django app that adds asgi support to runserver.
I also have a pr to django to add
get_response_async to make sure static files work with the ASGIStaticFilesHandler
These are 4 options I have thought of so far for a path to asgi support with runserver:
- Update runserver in django in a way that keeps the daphne import optional.
- Add daphne as a dependency to django and update runserver.
- Maintain a separate django app that holds the command that integrates daphne with runserver. Reference the app in asgi section of the django documentation.
- Add the commands to the daphne repository, perhaps allowing us to add
daphneas an installed app so the command is discovered, and reference this in the asgi section of the django documentation.
Right now I have some code as option (3). I feel like option (4) could make sense as well. This code is specifically tied to daphne. Since daphne is already a project under the django organization, maybe it’s ok to put a command in that package and add as a django app. It’s one fewer separate dependency to install. (1) and (2) would probably involve lots of discussion.
If you’d like to help on this task, you could make a pr to asgi-runserver app to help refactor code paths between asgi/wsgi, unless I get to it first . Alternatively, you could try out option (4) against daphe and see what it’s like.