All works fine with Next.js frontend and Flask backend.When I host the Flask backend on Windows machine, it is working fine but after hosting the backend on the Ubuntu server of Digital Ocean, the stream is not working and get the response at once.
`
@app.route('/get-data', methods=['GET'])def query1():try:
response = get_response() def stream_response_and_preprompts(): result = '' finished = 1 try: for chunk in response: result = result + str(chunk) yield chunk yield "end_with" except Exception as e: print(f"An error occurred: {e}") yield 'with_error' return Response(stream_with_context(stream_response_and_preprompts()), mimetype='text/event-stream') except Exception as e: print(e) return jsonify({"message":"Backend Error"}), 500`
I hosted the backend on Ubuntu server of Digital Ocean, the stream response is not working.I am not sure I have to configure some settings to allow the stream response on the Droplet instance of Digital Ocean.I'd like any advice.Thanks in advance