I recently created a web app and used the suggested file structuring from flask for separating views in different files. see here, http://flask.pocoo.org/docs/0.12/patterns/packages/.
But I also need to have the threaded parameter set to true which I would usually do at app.run(threaded=True) stage of testing. But I now run the app a different way, i tried putting "threaded=True" into my setup.py and that didn't do anything and was wondering how to get this working.
With threaded=True requests are each handled in a new thread. How many threads your server can handle concurrently depends entirely on your OS and what limits it sets on the number of threads per process. The implementation uses the SocketServer.
As of Flask 1.0, flask server is multi-threaded by default. Each new request is handled in a new thread. This is a simple Flask application using default settings.
Just tell the flask run
command to use threads:
$ export FLASK_APP=yourapplication
$ flask run --with-threads
Don't put this decision in your code; it is up to your WSGI server to run with threads or not.
You can see what options flask run
accepts with flask run --help
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With