文章詳情頁
Django crontab定時(shí)任務(wù)模塊操作方法解析
瀏覽:314日期:2024-09-22 10:53:16
Django crontab定時(shí)任務(wù)
安裝
pip install django-crontab
配置
在settings.py中 INSTALLED_APP中添加’django_crontab’
CRONJOBS = [(’*/1 * * * *’,’echo 'hello world' > /dev/null’)]
應(yīng)用
函數(shù)
def demo():你所要執(zhí)行的業(yè)務(wù)邏輯
CRONJOBS = [(’*/1 * * * *’,’demo函數(shù)路徑' ’)]
查看已有的定時(shí)任務(wù)
python manage.py crontab show
添加定時(shí)任務(wù)
python manage.py crontab add
刪除 python manage.py crontab remove 運(yùn)行 python manage.py crontab run從服務(wù)器確認(rèn)定時(shí)任務(wù)是否已經(jīng)添加
crontab -lcrontab -e
以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持好吧啦網(wǎng)。
標(biāo)簽:
Django
相關(guān)文章:
排行榜

網(wǎng)公網(wǎng)安備