Example project using Redis as a task queue
- From:
- Joe Esposito
- Date:
- 2011-10-01 @ 22:35
Hi all,
I've been noticing a lot of questions about how to handle background tasks
in Flask. So I wrote a small-but-functional Flask app that uses Redis to do
just that.
It's based off the Redis snippet, but with a little more functionality. Such
as: when developing locally, you only need to run redis-server and nothing
else. By default, running from the main script will start a thread for the
background worker so you can dive right into the coding and testing.
Unfortunately, I couldn't come up with a decent way to do this in
production, so you'll still have to run worker.py manually in that
environment. It's been a time saver for me in development though.
It still needs work and some better documentation, so I welcome any
feedback.
Hope this can help some of you when starting a project with background
tasks.
Demo: http://hello-redis-tasks.joeyespo.com/
Source: http://github.com/joeyespo/hello-redis-tasks
Joe