You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Google App Engine中Flask的/_ah/warmup端点已注册却无法访问的问题求助

Google App Engine中Flask的/_ah/warmup端点已注册却无法访问的问题求助

大家好,我碰到一个挺费解的问题,想请各位帮忙看看。我在Flask项目的main.py里注册了/_ah/warmup这个端点,代码如下:

# This is the Flask main.py
@app.route("/routes", methods=["GET"])
def routes():
    return ['%s' % rule for rule in app.url_map.iter_rules()], 200

@app.route("/_ah/warmup", methods=["GET"])
def warmup():
    return {}, 200

为了验证路由是否注册成功,我通过/routes端点查询了所有已注册的路由,线上请求结果显示/_ah/warmup确实在列表里:

(venv) ➜  app-engine git:(main) ✗ curl https://nutmeg-9099c.ew.r.appspot.com/routes -X GET
["/static/<path:filename>","/matches/","/matches","/matches/<match_id>","/matches/<match_id>/ratings","/matches/<match_id>/ratings/to_vote","/matches","/payments/checkout","/users/<user_id>","/users/test","/users/<user_id>/tokens","/routes","/_ah/warmup"]

可当我直接请求这个warmup端点时,却收到了404错误:

(venv) ➜  app-engine git:(main) ✗ curl https://nutmeg-9099c.ew.r.appspot.com/_ah/warmup -X GET
<html><head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>404 Not Found</title>
</head>
<body text=#000000 bgcolor=#ffffff>
<h1>Error: Not Found</h1>
<h2>The requested URL <code>/_ah/warmup</code> was not found on this server.</h2>
<h2></h2>

更奇怪的是,这个端点在本地运行时完全正常,只有部署到Google App Engine之后才出现这个404问题。有没有朋友遇到过类似情况,能帮忙分析下原因吗?

备注:内容来源于stack exchange,提问作者alexlipa

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.22 14:18:05