Your code assumes that your application can process several requests at once: the initial request plus the request that is generated during the processing of the initial file.
If you use a development server, for example app.run() , it runs in a single thread by default; therefore, it can only process one request at a time.
Use app.run(threaded=True) to enable multiple threads on the development server.
davidism
source share