Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Django 4.2 raises new warning #531

Open
stumpylog opened this issue Sep 29, 2023 · 10 comments
Open

Upgrade to Django 4.2 raises new warning #531

stumpylog opened this issue Sep 29, 2023 · 10 comments

Comments

@stumpylog
Copy link

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.

@stumpylog stumpylog changed the title Upgrade to Django 4.2 Upgrade to Django 4.2 raises new warning Sep 29, 2023
@bcail
Copy link

bcail commented Oct 18, 2023

Is your project public, or do you have some minimal code to reproduce the issue?

@stumpylog
Copy link
Author

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.

@bcail
Copy link

bcail commented Oct 19, 2023

Are you serving your app with uvicorn?

@stumpylog
Copy link
Author

gunicorn, though uvicorn is also installed. Sounds like you have an idea then maybe?

@bcail
Copy link

bcail commented Oct 19, 2023

uvicorn is for ASGI (async) processing. whitenoise doesn't seem to be supported on ASGI yet: see #359.

@stumpylog
Copy link
Author

Ah, that would do it. Thanks!

@bcail
Copy link

bcail commented Oct 20, 2023

You're welcome. I guess we could close this issue?

@stumpylog
Copy link
Author

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.

@jayqi
Copy link

jayqi commented Jul 18, 2024

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?

@Archmonger
Copy link
Contributor

This issue is caused by a lack of ASGI support within WhiteNoise,

For those looking for ASGI support, see ServeStatic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants