Set up a scheduled job?

后端 未结 24 2865
爱一瞬间的悲伤
爱一瞬间的悲伤 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 01:42

    Yes, the method above is so great. And I tried some of them. At last, I found a method like this:

        from threading import Timer
    
        def sync():
    
            do something...
    
            sync_timer = Timer(self.interval, sync, ())
            sync_timer.start()
    

    Just like Recursive.

    Ok, I hope this method can meet your requirement. :)

提交回复
热议问题