How to set up django app + redis + celery

I have recently deployed a Django app. The app uses a Redis server and a celery worker to send emails and celery-beat to perform some scheduled tasks. I am unable to find a proper doc that explains how to set up redis + celery worker for a django app in digitalocean. Please explain how to do this setup

Submit an answer
Answer a question...

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hello, I’ve been trying to sign up on the platform but it has not been working at all please how can this be rectified

Bobby Iliev
Site Moderator
Site Moderator badge
August 26, 2022

Hi there,

I could suggest starting with the following:

  • Make sure to first install Redis on your server:

  • Then deploy your Django app as normal:

  • After that, you need to install Celery and Redis in your virtual environments:
pip install celery 
pip install redis 
  • Next, in your file add the Redis details:
CELERY_BROKER_URL = 'redis://localhost:6379'
CELERY_RESULT_BACKEND = 'redis://localhost:6379'
CELERY_ACCEPT_CONTENT = ['application/json']
  • After that once your Django instance is up and running, you can also start your Celery worker, eg:
celery -A celearyapp worker -l info

For more information I could suggest the Celery official docs on how to get started with Celery and Django:

Let me know if you have any questions!