Setting up Celery and RabbitMQ

To install Celery with pip, run the following:

$ pip install Celery

We will also need a Flask extension to help handle initializing Celery:

$ pip install Flask-Celery-Helper

The Flask documentation states that Flask extensions for Celery are unnecessary. However, getting the Celery server to work with Flask's application context when your app is organized with an application factory is significant. So, we will use Flask-Celery-Helper to do the heavy lifting.

Next, RabbitMQ needs to be installed. RabbitMQ is not written in Python; therefore, installation instructions will be different for every OS. Thankfully, RabbitMQ maintains a detailed list of instructions for each OS at https://www.rabbitmq.com/download.html

Get Mastering Flask now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.