参考:http://www.mknight.cn/post/13/
https://blog.csdn.net/sicofield/article/details/50937338
一、INSTALLED_APPS = (
....
'djcelery',
)
二、
setting.py添加:
CELERYBEAT_SCHEDULE = {
'add-every-3-seconds': {
'task': 'test.tasks.test_celery',
# 'schedule': crontab(minute=u'40', hour=u'17',),
'schedule': timedelta(seconds=3),
'args': (16, 17)
},
'timing': {
'task': 'appdemo.tasks.test_multiply',
'schedule': crontab(minute=u'28', hour=u'11',),
# 'schedule': timedelta(seconds=3),
'args': (2, 3)
},
}
执行python3 manage.py celery -A test_django worker -B就能看到每三秒执行一次test_celery