Opened 4 months ago
Closed 4 months ago
#35701 closed Bug (duplicate)
Class BaseView. Use gzip_page Error: 'coroutine' object has no attribute 'streaming'
Reported by: | Ingward | Owned by: | |
---|---|---|---|
Component: | Generic views | Version: | 5.1 |
Severity: | Normal | Keywords: | |
Cc: | Ingward | Triage Stage: | Unreviewed |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
Can I use a decorator "gzip_page" with an asynchronous server and an asynchronous function async def get(self, request, *args, kwargs): ?
from django.views.decorators.cache import never_cache from django.views.decorators.csrf import csrf_protect from django.views.decorators.gzip import gzip_page @method_decorator([never_cache, csrf_protect, gzip_page], name='dispatch') class AccountIn(View): async def get(self, request, *args, **kwargs): return TemplateResponse(request, 'accounts/login.html', context={})
Server :
import uvicorn if __name__ == '__main__': uvicorn.run("app.asgi:application", reload=True, port=5000, log_level="info", lifespan='auto')
Error:
'coroutine' object has no attribute 'streaming'
...Lib\site-packages\django\middleware\gzip.py, line 20, in process_response
Change History (2)
comment:1 by , 4 months ago
Description: | modified (diff) |
---|
comment:2 by , 4 months ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
I think you can see the supported decorator list in the async documentation.
So I think
gzip_page
- yes butmethod_decorator
- noI believe this is a duplicate of #35083