今天带来Django crontab定时任务模块操作方法解析教程详解
Django crontab定时任务
安装
pip install django-crontab
配置
在settings.py中 INSTALLED_APP中添加'django_crontab'
CRONJOBS = [ ('*/1 * * * *','echo "hello world" > /dev/null') ]
应用
函数
def demo(): 你所要执行的业务逻辑
CRONJOBS = [ ('*/1 * * * *','demo函数路径" ') ]
查看已有的定时任务
python manage.py crontab show
添加定时任务
python manage.py crontab add
删除 python manage.py crontab remove 运行 python manage.py crontab run从服务器确认定时任务是否已经添加
crontab -l crontab -e
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持自学php网。
以上就是关于Django crontab定时任务模块操作方法解析全部内容,感谢大家支持自学php网。查看更多关于Django crontab定时任务模块操作方法解析的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://haodehen.cn/did6602