#31626 closed New feature (wontfix)
Add asgi support to runserver
Reported by: | Joshua Massover | Owned by: | nobody |
---|---|---|---|
Component: | HTTP handling | Version: | 3.0 |
Severity: | Normal | Keywords: | runserver, asgi |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
Previous conversation about this ticket can be found on the django forum
It would be great to add an asgi
flag such that runserver will "just work" with ASGI. eg.
./manage.py runserver --asgi
The 4 options I've thought of are the following:
- 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 daphne as an installed app so the command is discovered, and reference this in the asgi section of the django documentation.
I have an initial pr for (1). This code depends on #31594.
Change History (10)
comment:1 by , 5 years ago
Description: | modified (diff) |
---|
comment:2 by , 4 years ago
Resolution: | → needsinfo |
---|---|
Status: | new → closed |
comment:3 by , 4 years ago
Component: | Uncategorized → HTTP handling |
---|---|
Keywords: | runserver asgi added |
Triage Stage: | Unreviewed → Accepted |
OK, let's accept this as a new feature.
The suggestion in the forum thread is to detect if Daphne or uvicorn or ... is installed and then use that.
In the draft PR looks like importing Daphne in a try
block, which I´m not sure about at all.
Is there a way we can detect the asgi server without hard-coding imports?
I'd imagined a server based off of Python's http.server
, as we have for WSGI, either in Django or asigref
as appropriate.
In the meantime, 3.1 could probably do with some docs, saying to install channels (to use it's runserver) or uvicorn (which has a --reload
option).
comment:4 by , 4 years ago
Resolution: | needsinfo |
---|---|
Status: | closed → new |
comment:5 by , 4 years ago
Hey! So I recently had a user hit this issue when using the recently added async support to the Elasticsearch client library.
See here: https://github.com/elastic/elasticsearch-py/issues/1303
follow-up: 9 comment:6 by , 21 months ago
Has patch: | set |
---|
I've created a PR to doc that Daphne provided a runserver
implementation. (PR)
You enable it like this:
INSTALLED_APPS = [ "daphne", ... ]
Other packages could do similar easily enough.
I'm not 100% convinced it's worth extra code to scan installed dependencies, and check it they provide a runsever
.
It could be that we close this as wontfix
. 🤔
comment:9 by , 21 months ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
It could be that we close this as
wontfix
. 🤔
Let's close it.
comment:10 by , 21 months ago
Triage Stage: | Accepted → Unreviewed |
---|
I'm going to momentarily close this as
needsinfo
— let's continue the discussion on the forum thread: we can re-open if it's agreed to bundle this.