开发者

Call a method at a specific time for Django/Python?

开发者 https://www.devze.com 2023-01-10 19:16 出处:网络
In my Django web app, an event\'s status changes from \'upcoming\' to \'completed\' at a certain date/time. However, I want to update the database as soon as the event object\'s date/tim开发者_StackOv

In my Django web app, an event's status changes from 'upcoming' to 'completed' at a certain date/time. However, I want to update the database as soon as the event object's date/tim开发者_StackOverflow社区e has passed. Any ideas how I would code this?

My only idea so far is to have a thread constantly running that that checks to see if the event object's date/time as passed. However, this would be a really garbage way of doing things because there are potentially hundreds of event objects I would have to do this for.

Thanks for your help,

Chris


The django-chronograph app is one way to schedule jobs -- it relies on a cron job to automate scheduled running of django commands.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号