我正在为我的应用运行一个时钟测功机,但它在成功构建后立即崩溃。
错误信息 -
Build succeeded
heroku[clock.1]: State changed from up to crashed
heroku[clock.1]: State changed from crashed to starting
heroku[clock.1]: Starting process with command `python3 clock.py`
heroku[clock.1]: State changed from starting to up
heroku[clock.1]: Process exited with status 0
heroku[clock.1]: State changed from up to crashed
然后再次重复错误。
clock.py-
from apscheduler.schedulers.blocking import BlockingScheduler
sched = BlockingScheduler(timezone="UTC")
def job_1():
print("Reached Here")
sched.add_job(job_1,trigger='interval', seconds=150)
Procfile -
clock: python3 clock.py
答案 0 :(得分:0)
您应该更正您的Procfile
clock: python clock.py
Heroku 使用 3.9.6
作为默认值,但您可以根据需要更改此设置(请参阅 Specifying Python version)
答案 1 :(得分:0)
忘记包含 sched.start()