美文网首页
django定时任务

django定时任务

作者: 吴建台 | 来源:发表于2017-12-05 17:19 被阅读0次

1.安装django-crontab

pip install django-crontab

2.加入到settings.py的INSTALLED_APPS中

INSTALLED_APPS=(

'django-crontab',...

)

3.django-crontab定时运行函数

定时执行函数

格式'分 时 日 星期 月','app名.函数所在文件名.函数名','日志记录文件'

4.加载/卸载任务

python manage.py crontab remove

python manage.py crontab add

5.加载后启动服务

python manage.py runserver0.0.0.0:8000

相关文章

网友评论

      本文标题:django定时任务

      本文链接:https://www.haomeiwen.com/subject/gomcixtx.html