将应用程序部署到Google AppEngine后,从远程服务器启动我的应用程序遇到了很多麻烦。我查找了类似的问题,并尝试应用建议的修复程序,但仍然没有成功-我不断收到502 Bad Gateway Issue。有人可以建议吗?
文件夹结构如下:
目录:cross_sell_dash /
app.yml
database.py
Dockerfile
gcp-sa-creds.json
main.py
requirements.txt
app.yml
entrypoint: "gunicorn --bind:$PORT main:app"
env: flex
runtime: custom
main.py
app = Flask(__name__)
@app.route("/call/<function_name>/search/", methods=["GET"])
def callFunction(function_name: str):
user_id = request.args.get('user_id')
savm_id = request.args.get('savm_id')
business_sub_entity = request.args.get('business_sub_entity')
user_comments = request.args.get('user_comments')
user_approval = request.args.get('user_approval')
functionToCall = getattr(Database(), function_name)
return str(functionToCall(user_id, savm_id, business_sub_entity, user_comments, user_approval))
if __name__ == '__main__':
app.run(host='0.0.0.0', port=8080, debug=True)
Dockerfile
FROM python:3-onbuild
RUN mkdir /app
ADD . /app
WORKDIR /app
RUN pip3 --no-cache-dir install -r requirements.txt
EXPOSE 8080
ENTRYPOINT ["python3", "main.py"]
ENTRYPOINT ["gunicorn","--bind=0.0.0.0:8080","main:app"]
答案 0 :(得分:2)
entrypoint
Dockerfile
FROM python:3-onbuild
RUN mkdir /app
ADD . /app
WORKDIR /app
RUN pip3 --no-cache-dir install -r requirements.txt
EXPOSE 8080
ENTRYPOINT ["gunicorn", "--bind=0.0.0.0:8080", "main:app"]