Maison  >  Questions et réponses  >  le corps du texte

python - 如何在Flask应用中,执行定时任务。比如:每30秒执行某个任务?

如何在Flask应用中,执行定时任务。比如:每30秒执行某个任务?

黄舟黄舟2742 Il y a quelques jours875

répondre à tous(1)je répondrai

  • 天蓬老师

    天蓬老师2017-04-17 14:47:11

    • 可以通过 crontab执行shell脚本
    • 通过 threading 下的 Timer,自己实现一个 Scheduler ,这里有个例子 https://gist.github.com/chadselph/4ff85c8c4f68aa105f4b
    • 使用 celery。

    répondre
    0
  • Annulerrépondre