如何使用Django和Heroku设置调度程序和后台任务?

问题描述

我正在遵循此处的指南: https://devcenter.heroku.com/articles/clock-processes-pythonhttps://devcenter.heroku.com/articles/python-rq

我要构建的功能是每X天发送一次电子邮件功能

从本质上讲,我需要创建一个时钟进程,然后设置一个调度程序来执行时钟进程,但不确定如何在实际中工作。

从第一个链接开始,时钟过程如下:

from apscheduler.schedulers.blocking import BlockingScheduler

sched = BlockingScheduler()

@sched.scheduled_job('cron',day_of_week='mon-fri',hour=17)
def scheduled_job():
    print('This job is run every weekday at 5pm.')

sched.start()

应该在后台任务部分(https://devcenter.heroku.com/articles/python-rq中的哪个地方调用scheduled_job函数吗?

我得到了这两个宽松的文档,但不确定如何将它们绑在一起

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)