This repository contains example code based off of Miguel Grinberg's excellent blog article Using Celery with Flask and his example code.
The difference is that this code uses Flask-SocketIO (another excellent package by Miguel) to communicate status to the client without the client having to poll the server for status.
- Clone this repository.
- Create a virtualenv and install the requirements.
- Open a second terminal window and start a local Redis server (if you are on Linux or Mac, execute
run-redis.sh
to install and launch a private copy). - Open a third terminal window. Start a Celery worker:
venv/bin/celery worker -A app.celery --loglevel=info
. - Start the Flask application on your original terminal window:
venv/bin/python app.py
. - Go to
http://localhost:5000/
and enjoy this application!