Python multiprocessing in flask

This question was probably asked and most likely answered, but I do not know where to find it.

Problem: I have a python flash drive router that takes some time to process the data for each call. I need each of the route calls to be a thread on its own, so it does not need to wait for requests to load.

+7
python flask parallel-processing
source share
2 answers

Flask comes with an integrated development web server, but you should not use it in production .

To get interesting features, such as separate processes for each request and static file maintenance, you need to run the actual web service and the WSGI service in front of your Flask application.

Flask docs provide some examples of how to set this up . Popular combinations of Web Server / WSGI are Apache / mod_wsgi and Nginx / Gunicorn, but there are many other options.

+8
source share

A really good way to configure this would be to use “uwsgi” as your application server (and protocol) and Nginx as your external proxy. It is super fast, scalable, hand-carved, and it is one of Flask's recommended methods. Although the jar documentation contains a basic configuration, this manual is the one I used and provides a deeper step-by-step installation guide. They use Ubuntu, but with minor modifications (for installation commands) it will work on most Linux accessories.

https://www.digitalocean.com/community/tutorials/how-to-serve-flask-applications-with-uwsgi-and-nginx-on-ubuntu-14-04

+3
source share

All Articles