繁体   English   中英

部署 Flask 应用程序时,AWS ElasticBeanstalk 中出现 502 Bad Gateway 错误

[英]502 Bad Gateway Error in AWS ElasticBeanstalk while deploying Flask Application

我创建了一个 Flask 应用程序并将其部署在 AWS ElasticBeanstalk 中。 在访问 EBS URL 时,我收到 502 Bad Gateway Error。 nginx/1.16.1

在检查错误日志时,我看到以下错误:

[error] 3789#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 119.82.***.***, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8000/", host: "ec2-**-**-***-33.ap-south-1.compute.amazonaws.com"

我检查了所有可用的解决方案,但没有一个有效。 请帮忙。

将 app.py 重命名为 application.py,在应用代码中重命名为应用程序。 它对我有用。

from flask import Flask, render_template

application = Flask(__name__)

@application.route("/")
def index():
    return render_template('index.html')    

if __name__ == "__main__":
    application.run(debug=True)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM