djangocelerydjango-celery

"CELERY_BEAT_SCHEDULER" config is not work in django settings


I set CELERY_BEAT_SCHEDULER = "django_celery_beat.schedulers:DatabaseScheduler" in my django project settings file. But It doesn't seem to work.

I check the celerybeat logs and I found that the celery beat scheduler is celery.beat.PersistentScheduler. I can only set beat scheduler to "DatabaseScheduler" at the celery beat startup file (celery -A config beat -l info --scheduler django_celery_beat.schedulers:DatabaseScheduler).

How can I set the scheduler in django settings file ? I don't want to set the scheduler in the celery beat startup command.


Solution

  • Add the following option to Django settings.py

    For celery =< 4.4.0:

    CELERYBEAT_SCHEDULER = 'django_celery_beat.schedulers:DatabaseScheduler'
    

    For celery > 4.4.0:

    CELERY_BEAT_SCHEDULER = 'django_celery_beat.schedulers:DatabaseScheduler'