Web进程无法在启动后的60秒内绑定到$ PORT [英] Web process failed to bind to $PORT within 60 seconds of launch
本文介绍了Web进程无法在启动后的60秒内绑定到$ PORT的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
heroku [slug-compiler]:开始弹头编辑
heroku [slug编译完成:
heroku [web.1]:从崩溃状态改为启动
heroku [web.1]:用命令`python app.py $ {PORT}`$启动进程b $ b app [web.1]:*运行于http://127.0.0.1:5000/(按CTRL + C退出)
heroku [web.1]:错误R10(启动超时) - > ; Web进程无法在启动60秒内绑定到$ PORT
应用程序本身不是很复杂
from flask import Flask,render_template
app = Flask(__ name__,static_folder ='static')
@ app.route('/')
def hello_world():
return render_template('index.html')
if __name__ =='__main__':
从os导入environ
app.run(debug = False,port = environ.get(PORT,5000))
解决方案
b
您需要在<$ c中指定 host ='0.0.0.0'
$ C> app.run()。除非另有说明,Flask绑定到localhost,这意味着它不会绑定到一个外部可见的接口。
b
Can someone explain to me this error message on Heroku? App works fine locally but has never succeeded online
heroku[slug-compiler]: Slug compilation started
heroku[slug-compiler]: Slug compilation finished
heroku[web.1]: State changed from crashed to starting
heroku[web.1]: Starting process with command `python app.py ${PORT}`
app[web.1]: * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
The app itself is not very complicated
from flask import Flask, render_template
app = Flask(__name__, static_folder='static')
@app.route('/')
def hello_world():
return render_template('index.html')
if __name__ == '__main__':
from os import environ
app.run(debug=False, port=environ.get("PORT", 5000))
解决方案
You need to specify host='0.0.0.0'
in app.run()
. Unless told otherwise, Flask binds to "localhost", which means it won't bind to an externally visible interface.
See Flask - configure dev server to be visible across the network
这篇关于Web进程无法在启动后的60秒内绑定到$ PORT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文