Set up a scheduled job?

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

    Brian Neal's suggestion of running management commands via cron works well, but if you're looking for something a little more robust (yet not as elaborate as Celery) I'd look into a library like Kronos:

    # app/cron.py
    
    import kronos
    
    @kronos.register('0 * * * *')
    def task():
        pass
    

提交回复
热议问题