gpt4 book ai didi

python - 错误 R10(启动超时)-> Web 进程在启动后 60 秒内无法绑定(bind)到 $PORT

转载 作者:太空狗 更新时间:2023-10-29 21:20:39 25 4
gpt4 key购买 nike

我正在 heroku 部署一个 python 脚本,它会在每 3 分钟 后向另一台服务器发出请求。

部署进展顺利,但当我看到日志时,我遇到了这些错误

2016-11-01T07:42:12.919755+00:00 heroku[web.1]: Starting process with command `python script.py --log-file -`
2016-11-01T07:43:13.097413+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2016-11-01T07:43:13.097556+00:00 heroku[web.1]: Stopping process with SIGKILL
2016-11-01T07:43:13.196156+00:00 heroku[web.1]: Process exited with status 137
2016-11-01T07:43:13.212942+00:00 heroku[web.1]: State changed from starting to crashed
2016-11-01T07:43:13.213858+00:00 heroku[web.1]: State changed from crashed to starting
2016-11-01T07:43:16.719828+00:00 heroku[web.1]: Starting process with command `python script.py --log-file -`
2016-11-01T07:44:17.215381+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2016-11-01T07:44:17.215381+00:00 heroku[web.1]: Stopping process with SIGKILL
2016-11-01T07:44:17.364708+00:00 heroku[web.1]: Process exited with status 137
2016-11-01T07:44:17.367610+00:00 heroku[web.1]: State changed from starting to crashed

程序文件

web: python script.py --log-file -

脚本.py

import sys
import requests
from apscheduler.schedulers.blocking import BlockingScheduler

sched = BlockingScheduler()

@sched.scheduled_job('interval', minutes=3)
def timed_job():
try:
request = requests.get(url='https://royal-tag-services.herokuapp.com/api/sms-service/scheduler/')
except Exception as e:
print >>sys.stderr, 'scheduler request failed'

sched.start()

“tree -L 1”命令的结果

├── Procfile
├── requirements.txt
├── script.py
└── supporterenv

最佳答案

在您的 Procfile 中将“web”替换为“worker”。

关于python - 错误 R10(启动超时)-> Web 进程在启动后 60 秒内无法绑定(bind)到 $PORT,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40356197/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com