Skip to content

Latest commit

 

History

History
29 lines (25 loc) · 906 Bytes

File metadata and controls

29 lines (25 loc) · 906 Bytes

About repository:

This is a repository prepared for answer on StackOverflow to have ability to download code and test it.

Question is about Django StreamingHttpResponse in async Django views. Look here for more details.

How to use it:

Run Django web-server using Daphne:

daphne -b 0.0.0.0 -p 8000 webapp.webapp.asgi:application

NOTE: I have 2 levels folder, but this is just because copy-paste from my test project. In yours it still can be sse_demo.asgi:application

Run script to check view:

python test_stream.py

Sync:

Uncomment line in test_stream.py:

r = requests.get('http://localhost:8000/sse', stream=True)

ASync:

Uncomment line in test_stream.py:

r = requests.get('http://localhost:8000/sse_async', stream=True)