我正在按照这个来安排我在 Heroku 上的 Django cron 作业。
Procfile
:
web: gunicorn tango.wsgi --log-file -
clock: python createStatistics.py
createStatistics.py
:
from apscheduler.schedulers.blocking import BlockingScheduler
sched = BlockingScheduler()
@sched.scheduled_job('interval', minutes=1)
def timed_job():
print('This job is run every minute.')
@sched.scheduled_job('cron', day=14, hour=15, minute=37)
def scheduled_job():
print('This job is run on day 14 at minute 37, 3pm.')
sched.start()
运行正常,timed_job
但是scheduled_job
没有效果。我是否需要为apscheduler
(我设置了 TIME_ZONE settings.py
)设置任何时区信息?如果是这样,怎么做?还是我错过了什么?