More Related Content
Similar to Flask With Server-Sent Event (20)
Flask With Server-Sent Event
- 8. =
+
Werkzeug
WSGI utility library
- 9. =
+
Werkzeug
WSGI utility library
- 10. =
+
Werkzeug Jinja2
WSGI utility library template engine
- 23. Demo
redis:
demo:FILE_TEXT -- 每次python读出来的文本
demo:FILE_TEXT_SEQ -- 为文本版本号, 每次文本更新, 版本号+1
/sever_push响应 -- 当FILE_TEXT_SEQ增加时, 将最新的文本返回给浏览器
- 27. Demo
result???
• terminal run: python hello.py
• open http://localhost:5000
• block!!!
- 28. Demo
result???
• terminal run: python hello.py
• open http://localhost:5000
• block!!!
solution???
- 29. Demo
result???
• terminal run: python hello.py
• open http://localhost:5000
• block!!!
solution???
• async WSGI server! (eg. gunicorn + gevent, gevent)
- 30. Demo
result???
• terminal run: python hello.py
• open http://localhost:5000
• block!!!
solution???
• async WSGI server! (eg.-kgunicorn-bgevent, gevent)hello:app
+
• terminal run: gunicorn gevent '0.0.0.0:5000'
- 31. Demo
result???
• terminal run: python hello.py
• open http://localhost:5000
• block!!!
solution???
• async WSGI server! (eg.-kgunicorn-bgevent, gevent)hello:app
+
• terminal run: gunicorn gevent '0.0.0.0:5000'
• open http://localhost:5000
- 32. Demo
result???
• terminal run: python hello.py
• open http://localhost:5000
• block!!!
solution???
• async WSGI server! (eg.-kgunicorn-bgevent, gevent)hello:app
+
• terminal run: gunicorn gevent '0.0.0.0:5000'
• open http://localhost:5000 again!
• open http://localhost:5000