我创建了一个Flask应用程序,并将其部署在AWS ElasticBeanstalk中。在访问EBS URL时,我收到502坏网关错误。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,将应用程序内代码重命名为application。它对我有效。
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)