whitenoise
whitenoise copied to clipboard
Upgrade to Django 4.2 raises new warning
Python Version
3.11.5
Django Version
4.2.5
Package Version
6.5.0
Description
After upgrading a project from Django 4.1.9 to Django 4.2.5, there is a new warning in my application logs:
django/http/response.py:518: Warning: StreamingHttpResponse must consume synchronous iterators in order to serve them asynchronously. Use an asynchronous iterator instead.
After some work and adding some patching, the response in this case is a WhiteNoiseFileResponse. As far as I can tell, everything works correctly, but it would be nice to not have this warning, without silencing it myself.
Is your project public, or do you have some minimal code to reproduce the issue?
https://github.com/paperless-ngx/paperless-ngx. dev has upgraded to 4.2. The warning occurs when loading a page. At least it only appears once.
Are you serving your app with uvicorn?
gunicorn, though uvicorn is also installed. Sounds like you have an idea then maybe?
uvicorn is for ASGI (async) processing. whitenoise doesn't seem to be supported on ASGI yet: see https://github.com/evansd/whitenoise/pull/359.
Ah, that would do it. Thanks!
You're welcome. I guess we could close this issue?
It might be better to remain open, linked to be closed with #359, if it can ever merge. Others will probably be seeing it soon enough as they upgrade.
I understand that WhiteNoise does not yet support ASGI, but I would like to better understand whether this warning is critical (this will break something or severely impact performance) or if it's minor.
I'm seeing guides that both recommend WhiteNoise and recommend running with ASGI (e.g., this guide from Render). Is this a reasonable default for a new application?