Using celery with Flask
This repository contains two examples of using Celery
- Send Asynchronous Email
- Long running task with progress update
Quick Setup
Clone the repository.
->create virtualenv
$ virtualenv venv // this command to create virtual environment
->activate the virtual environment
$ source venv/bin/activate
->Install the requirements
$ pip install -r requirements.txt
Install the redis from https://redis.io/download .
How to run the project
You need to run three terminals
In first terminal,
$ cd Project-Folder
$ ./run-redis.sh
In second terminal.
$ cd Project-Folder
$ export MAIL_USERNAME=your-gmail-username
$ export MAIL_PASSWORD=your-gmail-password
$ source venv/bin/activate
(venv) $ celery worker -A app.celery --loglevel=info
In third terminal,
$ source venv/bin/activate
(venv) $ python app.py
Finally,
Go to http://localhost:5000/ and enjoy this application!