有人可以向我解释 Heroku 上的此错误消息吗?应用程序在本地运行良好,但在网上从未成功
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
应用程序本身并不是很复杂
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))
您需要指定host='0.0.0.0'
in app.run()
。除非另有说明,Flask 绑定到“localhost”,这意味着它不会绑定到外部可见的接口。
See Flask - 配置开发服务器在网络上可见 https://stackoverflow.com/questions/7023052/flask-configure-dev-server-to-be-visible-across-the-network
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)