The following is my code :
from flask import Flask
app = Flask(__name__)
@app.route('/hello/<value>')
def hello_world(value):
if value == "1":
while True:
print('hello')
else:
return 'Hello ';
if __name__ == '__main__':
app.run()
I wrote this code to see whether the flask app spawns a thread with each request or not.
I opened two tabs where in the first tab I passed the value as '1' and '2' to the other. The first blocked the tab and second displayed 'Hello' on the browser.
My query is whether each request to a flask server is run on a separate thread ? If yes why do we have the following feature in flask ?
app.run(threaded=True)