使用步骤
安装包
pip install django-celery-beat
app注册
app注册
INSTALLED_APPS = [
....
'django_celery_beat',
]
配置文件:屏蔽原来的调度器
CELERY_BEAT_SCHEDULER = 'django_celery_beat.schedulers.DatabaseScheduler'
设置时区
LANGUAGE_CODE = 'zh-hans'
TIME_ZONE = 'Asia/Shanghai'
USE_I18N = True
USE_TZ = False
数据库迁移
python manage.py migrate django_celery_beat
启动worker 和 beat
# 分别起两个控制台 启动
celery -A luffy_api.celery1 worker -l debug -P eventlet
celery -A luffy_api.celery1 beat -l debug
创建超级用户-访问admin的wed管理端
http://127.0.0.1:8000/admin/
添加定时任务
标签:USE,beat,app,django,celery,admin From: https://www.cnblogs.com/Hqqqq/p/18199226