我正在尝试通过Flask服务器在Heroku上部署python Reddit流应用程序。 cri_red.py代码如下
from flask import Flask
for comment in reddit.subreddit('cricket').stream.comments():
print(comment.body)
app = Flask(__name__)
app.run(environ.get('PORT'))
我的Procfile包含Web:python cri_red.py runserver 0.0.0.0:$PORT 当我部署这个。我能够运行python应用程序一段时间,然后出现如下错误
2019-07-18T04:49:57.649963+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2019-07-18T04:49:57.650059+00:00 heroku[web.1]: Stopping process with SIGKILL
2019-07-18T04:49:57.742221+00:00 heroku[web.1]: State changed from starting to crashed
2019-07-18T04:49:57.720842+00:00 heroku[web.1]: Process exited with status 137
我该如何解决?我尝试通过使用proc更改procfile:python cri_red.py最终遇到与上述相同的错误。