[英]502 Bad Gateway nginx in Google Cloud
Even I install the即使我安装了
pip install flask-wtf
into my virtual env and i got tested already and it was okay to run.进入我的虚拟环境,我已经测试过了,可以运行了。 However, when I deploy to google cloud engine, I could not able to do anythings.
但是,当我部署到谷歌云引擎时,我什么也做不了。 It show the error '502 Bad Gateway nginx' and Google Console tells me ' ModuleNotFoundError: No module named 'wtforms ' and ' HaltServer: HaltServer 'Worker failed to boot.'
它显示错误“502 Bad Gateway nginx”,Google 控制台告诉我“ ModuleNotFoundError:没有名为“wtforms ”的模块和“ HaltServer: HaltServer Worker failed to boot”。 3' But i got the code below
3'但我得到了下面的代码
from wtforms import StringField, PasswordField, SubmitField, BooleanField
already in my main.py.已经在我的 main.py 中。 Is there any why to figure it out?
有什么原因要弄清楚吗? on google Cloud deploy?
在谷歌云部署上?
You need a folder app
with this structure:您需要一个具有以下结构的文件夹
app
:
cd app
ls
#app.yaml main.py requirements.txt
Where:在哪里:
cat app.yaml
runtime: python37
cat requirements.txt
Flask==1.1.1
flask-wtf
cat main.py
from flask import Flask
from wtforms import StringField, PasswordField, SubmitField, BooleanField
app = Flask(__name__)
@app.route('/')
def hello():
"""Return a friendly HTTP greeting."""
return 'Hello World!'
Then inside app
folder run:然后在
app
文件夹中运行:
gcloud app deploy -q
gcloud app browse
#Go to https://your-project.appspot.com
#Hello World!
SUCCESS!成功!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.