我用Flask创建了一个Web应用程序,它expose 了8080端口并显示了一些html页面,并将其部署到Google Cloud Run中. 这是基本代码.
app = Flask(__name__)
@app.before_request
def before_request():
session.permanent = True
app.permanent_session_lifetime = timedelta(minutes=settings.session_lifetime_minutes)
session.modified = True
g.user = current_user
login_manager = LoginManager()
login_manager.init_app(app)
@app.route("/")
def index():
return render_template('authentication.html')
然而,当我设置了每个人都可以使用的服务入口,并通过浏览器访问由Google(https://myproject.run.app)提供的URL时,我等待了5/10秒,然后得到"服务不可用". 通过判断日志(log),我看到以下错误日志(log):
severity: "ERROR"
textPayload: "The request failed because either the HTTP response was malformed or connection to the instance had an error. Additional troubleshooting documentation can be found at: https://cloud.google.com/run/docs/troubleshooting#malformed-response-or-connection-error"
然而,在故障排除指南中,我没有发现任何有用的信息.
当我设置只有内部用户才能使用的服务入口,并try 使用Google建议的cURL时,我得到的结果如下:
<html><head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>404 Page not found</title>
</head>
<body text=#000000 bgcolor=#ffffff>
<h1>Error: Page not found</h1>
<h2>The requested URL was not found on this server.</h2>
<h2></h2>
</body></html>
有人能帮我了解一下发生了什么事吗?谢谢!