Reputation: 422
I am using Django celery beat with celery,
Problem which I am facing is my when I am using scheduler provided by Django-celery beat it doesn't work but using normal beat without scheduler provided by Django-celery-beat works with below command
Doesn't works => celery worker --app=my_project.celery_app -l info --beat --scheduler django_celery_beat.schedulers:DatabaseScheduler
Works => celery worker --app=my_project.celery_app -l info --beat
one thing I noticed when I change Time_Zone to 'UTC' Django-celery-beat scheduler starts working, but i don't want to change timezone settings for djagno how do I fix this
please find my settings below
USE_TZ = False
TIME_ZONE = 'Asia/Kolkata'
CELERY_TIMEZONE = 'Asia/Kolkata'
Upvotes: 0
Views: 1182
Reputation: 21
Can you try overriding the Database scheduler and override schedule method, celery worker --app=my_project.celery_app -l info --beat --scheduler django_celery_beat.schedulers:DatabaseScheduler
i have changed and data seems to show on the log file
Upvotes: 1
Reputation: 51
I am sure, there must be a way to do this,
but, I would recommend you to never use tz=False in Django as every standard application is timezone aware and is using UTC as default, it doesn't matter if you are in India or any other country
Hope it makes your application better if you face any error with UTC feel free to ask here
PS. even if you want to check out other library, do look into below library
https://pypi.org/project/django-celery/
Upvotes: 0
Reputation: 144
You could try this:
celery -A my_app.celery:app beat -l info --scheduler django_celery_beat.schedulers:DatabaseScheduler
Also, make sure you have django_celery_beat
installed and it's added in your settings.py
:
INSTALLED_APPS = (
...,
'django_celery_beat',
)
then python manage.py migrate
here you can find more on the beat configuration.
Upvotes: 0