All Projects → joeyespo → hello-redis-tasks

joeyespo / hello-redis-tasks

Licence: MIT license
An example of how to use Redis as a task queue within a Flask web application.

Programming Languages

python
139335 projects - #7 most used programming language
HTML
75241 projects
CSS
56736 projects

Hello Redis Tasks

An example of how to use Redis as a task queue within a Flask web application.

Usage

Be sure to have redis-server running.

When running locally, all you need to do is run hello_redis_tasks.py and it will use Flask to serve the app and also to run background tasks. In production, you'll also have to run worker.py in a separate process in addition to serving your app.

How It Works

Clicking 'Add' will tell the web app to start a new task, then display the progress page. In the code, you'll see that starting a new task is as simple as pushing some data onto a Redis list. The app is then free to complete the web request the external worker.py process does all the work. Meanwhile the processing page, using AJAX, will poll the server until it responds with 'ready=true', to which it redirects you to the results page.

Was this helpful?

If you have any suggestions to make it even simpler or more clear, please feel free to let me know.

Also, if you find this useful, please consider supporting me on Gittip

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].