Python Forum
Flask Streaming not working on IIS Windows - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Web Scraping & Web Development (https://python-forum.io/forum-13.html)
+--- Thread: Flask Streaming not working on IIS Windows (/thread-22355.html)



Flask Streaming not working on IIS Windows - Revencu - Nov-09-2019

Need a help please:
I created an app to testing stream on Windows.
In development mode the streaming response working (get response in each second). But when deploy to IIS Windows and run in production mode then I receive the full body of response at end (streaming not working).
What I need to set in IIS to allow the streaming? Thanks
from flask import Flask, Response
from datetime import datetime
import time

app = Flask(__name__)

@app.route('/')
def first(): return 'ok'

@app.route('/stream')
def default():
    def generate():
        for i in range(0,10):
            yield datetime.now().strftime('%H:%M:%S')
            time.sleep(1)
    return Response(generate(), mimetype='text/event-stream')

if __name__ == '__main__':
	app.run(host='0.0.0.0', debug=True, port=5001)