I would highly recommend using a queuing mechanism such as Redis or RabbitMQ. The flask will act as a producer, and your "worker" will consume and process.
Setting up any of these tools is much less complicated than you might expect.
sudo apt-get install redis-server sudo apt-get install python-pip sudo pip install redis
Your flask application acts as a manufacturer
>>> from redis import Redis >>> r = Redis() >>> r.lpush('task_queue', 'task1') 1L
And your βworkerβ consumes and processes asynchronously:
>>> r.rpop('task_queue') 'task1'
source share