wowkin2 / django-test-streaming-response Goto Github PK
View Code? Open in Web Editor NEWRepo to show how Django StreamingHttpResponse works with async views
Repo to show how Django StreamingHttpResponse works with async views
Hi,
If you run a second instance of test_stream.py
, you get the following error:
(redacted)\lib\site-packages\django\template\base.py:766: RuntimeWarning: coroutine 'AsyncToSync.main_wrap' was never awaited
self.literal = float(var)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Internal Server Error: /sse_async
Traceback (most recent call last):
File "(redacted)\lib\site-packages\django\core\handlers\exception.py", line 47, in inner
response = get_response(request)
File "(redacted)\lib\site-packages\django\core\handlers\base.py", line 179, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "(redacted)\lib\site-packages\asgiref\sync.py", line 114, in __call__
self._run_event_loop, loop, awaitable
File "(redacted)\python37\lib\concurrent\futures\thread.py", line 165, in submit
raise RuntimeError('cannot schedule new futures after '
RuntimeError: cannot schedule new futures after interpreter shutdown
2020-08-21 09:48:56,674 django.request ERROR Internal Server Error: /sse_async
Traceback (most recent call last):
File "(redacted)\lib\site-packages\django\core\handlers\exception.py", line 47, in inner
response = get_response(request)
File "(redacted)\lib\site-packages\django\core\handlers\base.py", line 179, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "(redacted)\lib\site-packages\asgiref\sync.py", line 114, in __call__
self._run_event_loop, loop, awaitable
File "(redacted)\python37\lib\concurrent\futures\thread.py", line 165, in submit
raise RuntimeError('cannot schedule new futures after '
RuntimeError: cannot schedule new futures after interpreter shutdown
Tested with:
Best regards,
Benoit
Hi,
As soon as someone gets /sse_async
, the Daphne process enters an infinite loop and cannot be stopped with Ctrl-C
.
Tested with:
Best regards,
Benoit
Hi,
When I follow the instructions on README, here is what happens:
$ python test_stream.py
2020-08-21 09:36:51,750 __main__ INFO Started downloading content
On the server-side, however, I can see:
2020-08-21 09:36:53,777 INFO Generated message for iteration: iteration 000000
2020-08-21 09:36:54,778 INFO Generated message for iteration: iteration 000001
Tested with:
Best regards,
Benoit
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.