Keshav Agrawal
Keshav Agrawal

Reputation: 597

django-celery vs django-celery-beat with Django 2.2

We have been working with celery and django-celery till now but recently we planned to migrate our codebase to Django==2.2 and looks like django-celery doesn't have support for Django==2.2 yet.

With django-celery we could configure periodic tasks from django admin. Is it safe to assume that if I want the similar functionality then apart from Celery package and running celerybeat instance I would have to install django-celery-beat package instead of django-celery - without doing massive code changes?

Upvotes: 0

Views: 1138

Answers (1)

Kutera
Kutera

Reputation: 36

django-celery can be removed. I used it but celery can work fine without it. Just see https://docs.celeryproject.org/en/stable/django/first-steps-with-django.html

Your tasks remains the same.

I used periodic tasks with the following packages installed:

celery==4.4.7
kombu==4.6.10
django-celery-beat==1.4.0

The INSTALLED_APP : add 'django_celery_beat',

example:

from celery import shared_task
from django.utils.translation import gettext_lazy as _
from django.core.mail import mail_admins

@shared_task(longname=_("Send mail to administrators"))
def mail_admins_delayed(subject, message):
    mail_admins(subject, message)

Start celery from your django workdir with

celery worker --app <djangoprojectname>
celery -A <djangoprojectname> beat

Upvotes: 2

Related Questions