celery定时任务第一弹
celery.py
# 设置时区
app.conf.timezone = 'Asia/Shanghai'
# 是否使用UTC
app.conf.enable_utc = False
from datetime import timedelta
app.conf.beat_schedule = {
'low-task': {
'task': 'renwu.renwu_1.send_sms',
'schedule': timedelta(seconds=5), # 每隔5s调用一次
'args': ('13211112222', '哈喽哈喽'),
}
}
# 命令,必须启动beat,让beat提交定时任务
# celery -A celery_task beat -l info

浙公网安备 33010602011771号