[英]Google AppEngine: 502 Bad Gateway From Deploying Flask App
I'm experiencing so much trouble launch my application from the remote server after deploying it to Google AppEngine.在将应用程序部署到 Google AppEngine 后,我在从远程服务器启动应用程序时遇到了很多麻烦。 I've looked up similar questions and tried to apply the suggested fixes, but still no success - I keep getting that 502 Bad Gateway Issue.
我查找了类似的问题并尝试应用建议的修复程序,但仍然没有成功 - 我不断收到 502 Bad Gateway 问题。 Could someone please advise?
有人可以建议吗?
Folder structure is like this:文件夹结构是这样的:
directory: cross_sell_dash/
目录:cross_sell_dash/
app.yml应用程序.yml
database.py数据库.py
DockerfileDockerfile
gcp-sa-creds.jsongcp-sa-creds.json
main.py主文件
requirements.txt要求.txt
app.yml
应用程序.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
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"]
entrypoint
in app.yamlentrypoint
点Dockerfile
as followsDockerfile
如下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"]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.