I am trying to deploy a simple Flask
application on the Google App Engine, Issue is that code is getting deployed without an error but when I access the URL of the deployed app then I get the error "502 Bad Gateway"
Logs
Below is the code I am using
app.yaml
runtime: custom
env: flex
entrypoint: gunicorn -b :$PORT main:app
runtime_config:
python_version: 3
manual_scaling:
instances: 1
resources:
cpu: 1
memory_gb: 1
disk_size_gb: 10
Dockerfile
FROM ubuntu:18.04
RUN apt-get update \
&& apt-get install -y apt-utils \
python3.6 \
python3-pip
WORKDIR /app
COPY . /app
RUN pip3 install -r requirements.txt
ENTRYPOINT ["python3"]
CMD ["main.py"]
main.py
from flask import Flask, jsonify
app = Flask(__name__)
@app.route('/')
def index():
return jsonify('Hello World')
if __name__ == '__main__':
app.run(debug=True)
requirements.txt
Flask
gunicorn
CodePudding user response:
Posting @JohnHanley's comment for visibility.
The default port is 8080. Flask listens on port 5000. Change your code as follows: app.run(host='0.0.0.0', port=8080)