Skip to content

Repo to show how Django StreamingHttpResponse works with async views

Notifications You must be signed in to change notification settings

wowkin2/django-test-streaming-response

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)

About

Repo to show how Django StreamingHttpResponse works with async views

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages