Python Forum

Full Version: Flask Streaming not working on IIS Windows
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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)