#34428: ASGIStaticFilesHandler raises warning.
-------------------------------------+-------------------------------------
               Reporter:  Carlton    |          Owner:  Carlton Gibson
  Gibson                             |
                   Type:  Bug        |         Status:  assigned
              Component:             |        Version:  4.2
  contrib.staticfiles                |
               Severity:  Release    |       Keywords:
  blocker                            |
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 #33735 added async support to StreamingHttpResponse for Django 4.2.

 With Django 4.2rc1 and Daphne, ``` raises a warning about the incorrect
 iterator type being used:

 > http/response.py:534: Warning: StreamingHttpResponse must consume
 synchronous iterators in order to serve them asynchronously. Use an
 asynchronous iterator instead.

 This is because `FileResponse` is not async compatible (nor is that
 likely, since neither is `open()`).

 A new project with:


 {{{
 INSTALLED_APPS = [
     "daphne",
     ...
 ]

 ASGI_APPLICATION = "project.asgi.application"
 }}}

 `runserver`, and then visit any page serving static files such as
 `/admin/`.

 The fix is to have `ASGIStaticFilesHandler` adapt the iterator in the same
 way `StreamingHttpResponse` does.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34428>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018704cb9388-505cb9c7-0c13-4cf6-a760-51f087619519-000000%40eu-central-1.amazonses.com.

Reply via email to