Install Celery as Your Task Queue

00:00 Install Celery as your task queue. Now that you’ve set up the feedback app and felt the lag that comes from sending email, you can set out to improve the user experience.

00:11 The first step in integrating Celery into your Django app is to install Celery into the virtual environment.

00:25 However, just installing Celery isn’t enough. If you attempt to run the task queue, you’ll notice that Celery first seems to start up fine, but then displays an error message that indicates that it can’t find a message broker.

00:43 Celery needs a message broker to communicate with programs that send tasks to the task queue. Without a broker, it’s unable to receive instructions, which is why it keeps trying to reconnect.

00:55 You can use Ctrl and C to shut Celery down and it will take a few seconds to do so, but you should see the messages seen on screen.

01:08 You may have noticed the URL-like syntax in the target that Celery attempts to connect to the protocol name. AMQP stands for Advanced Message Queuing Protocol, and is the messaging protocol that Celery uses.

01:21 The best-known project that implements AMQP natively is RabbitMQ, but Redis can also communicate using it.

01:30 Before using Celery, you need to install a message broker and define a project as a message producer. In your case, the producer is your Django app, and the message broker will be Redis.

01:43 Redis is the next missing part of the puzzle. So in the next video, you’ll take a look at installing it.

Become a Member to join the conversation.