adamchainz / django-browser-reload

Automatically reload your browser in development.
MIT License
506 stars 26 forks source link

django StreamingHttpResponse - Consume async iterator #239

Open vshah11 opened 7 months ago

vshah11 commented 7 months ago

Python Version

~=3.10.5

Django Version

4.2.7

Package Version

1.12.1

Browser

Chrome, Safari

Description

Warning: StreamingHttpResponse must consume synchronous iterators in order to serve them asynchronously. Use an asynchronous iterator instead.

My application does not explicitly use StreamingHttpResponse or FileResponse in any of its views and I still keep getting this warning every time my application starts. The application is served under ASGI using Uvicorn. Any suggestions how do I get rid of this warning?

I have narrowed down that django-browser-reload is the one that might be potentially causing this warning for me. Any help is appreciated.

roushikk commented 4 months ago

Hi, I am able to use django-browser-reload under ASGI using Uvicorn without this issue. Python: 3.12.2 Django: 4.2.11 Package: 1.12.1

I was also getting the same error but that was caused by Whitenoise as it does not support ASGI as of now. Are you using whitenoise by any chance? If yes, try disabling it and see if it fixes the issue.

mraesener-aubex commented 1 month ago

FYI in short:

currently there's an "official" or "blessed" fork of Whitenoise because of ASGI until the Whitenoise maintainers find the time again.

WhiteNoise -> ServeStatic

See https://github.com/evansd/whitenoise/pull/359