Set up a scheduled job?

后端 未结 24 2994
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-22 01:13

I\'ve been working on a web app using Django, and I\'m curious if there is a way to schedule a job to run periodically.

Basically I just want to run through the dat

24条回答
  •  傲寒
    傲寒 (楼主)
    2020-11-22 02:00

    We've open-sourced what I think is a structured app. that Brian's solution above alludes too. We would love any / all feedback!

    https://github.com/tivix/django-cron

    It comes with one management command:

    ./manage.py runcrons
    

    That does the job. Each cron is modeled as a class (so its all OO) and each cron runs at a different frequency and we make sure the same cron type doesn't run in parallel (in case crons themselves take longer time to run than their frequency!)

提交回复
热议问题