flask-socketio-celery-example
flask-socketio-celery-example copied to clipboard
Example based on Miguel Grinberg's flask-celery-example but using Flask-SocketIO
Using Celery with Flask-SocketIO
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.
Quick Setup
- 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.shto 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!