35👍
The root cause, in this case, is that the beat scheduler needs to be started with the appropriate arguments. You supplied the following command:
$ celery -A sandbox worker --loglevel=debug
However, to start celery with a beat schedule, (as opposed to a regular celery worker) you must specify beat
rather than worker
. Moreover, when using the django_celery_beat
extension, it is necessary to use the Database scheduler django_celery_beat.schedulers:DatabaseScheduler
rather than the default scheduler celery.beat.PersistentScheduler
.
So the corrected command would be:
$ celery -A sandbox beat --loglevel=debug --scheduler django_celery_beat.schedulers:DatabaseScheduler
3👍
If you want to run Beat & Worker together, use the --beat
flag.
celery -A sandbox worker --beat --loglevel=debug
- How to manage.py loaddata in Django
- How to have a link in label of a form field
- Django-Rest-Framework serializer class meta
- Calculate point based on distance and direction
- Sending a message to a single user using django-channels
2👍
I think you did not define the cron shcedule. Where is it stored? Usually it is on disk or in database (django_celery). See http://docs.celeryproject.org/en/latest/userguide/periodic-tasks.html
Also, you have to run your worker with a beat option
2👍
Add below code in “init.py” which is in “sandbox” project to pick task to Django admin.
This will make sure the app is always imported when django starts so that task will use this app.
from __future__ import absolute_import, unicode_literals
from .celery import app as celery_app
__all__ = ('celery_app',)
- Is there a way to render a html page without view model?
- How to unit test methods inside django's class based views?
- What does it mean for an object to be unscriptable?