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
posted @ 2025-02-24 15:39  Jude~  阅读(11)  评论(0)    收藏  举报