A simple setup illustrating redis-queue based background task processing in Python. Supports heroku.
app.py: File that defines some API resources.Procfile: For herokutasks.py: A file that consists of some tasks (simple python functions) that we want to be queued.worker.py: The redis queue worker node.interface.py: Contains functions that you can use to interact with the queue.
- Add
worker: python -u worker.pyto your Procfile. - Add the redistogo addon from CLI
$ heroku addons:create redistogo- Start one worker dyno
heroku scale worker=1 - Deploy and should be good to go.
Demo available at background-queue.herokuapp.com/