Correct way of running long tasks in Flask
Key to the answer is Celery. Good post: Using Celery With Flask Sources See also: Making an asynchronous task in Flask Sharing memory and using multiprocessing along with gunicorn seem to be wrong solutions.