I have created a Flask Application and deployed it in AWS ElasticBeanstalk. On accessing the EBS URL, I am getting the 502 Bad Gateway Error. nginx/1.16.1
On checking the error logs i see the following error:
[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"
I checked all the available solutions, but none of them work. Please help.
rename app.py to application.py, in app code to application. It worked for me.
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)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.