有人可以举例说明预热入站服务如何在 Google App Engine 的 python 运行时中工作吗?
我读过这个:http://code.google.com/appengine/docs/python/config/appconfig.html#Inbound_Services http://code.google.com/appengine/docs/python/config/appconfig.html#Inbound_Services,但在发送 GET 请求后它并没有给我太多的例子(我似乎永远无法拿起它)
我的 app.yaml 如下所示:
application: whatevs
version: 1
runtime: python
api_version: 1
builtins:
- datastore_admin: on
inbound_services:
- warmup
handlers:
- url: /static
static_dir: static
- url: /_ah/warmup
script: main.py
login: admin
- url: /.*
script: main.py
我的 main.py 看起来像这样:
def main():
application = webapp.WSGIApplication(
[("/", views.LandingPage),
("/_ah/warmup", views.WarmupHandler)
],
debug=True)
run_wsgi_app(application)
WarmupHandler 看起来像这样:
class WarmupHandler(webapp.RequestHandler):
"""
Called on app init
"""
def get(self):
current_user = users.get_current_user()
return
但是,WarmupHandler 似乎从未被调用(我有断点和大量调试代码)。我究竟做错了什么?
仅当您的应用程序上存在持续流量时,App Engine 才会发送预热请求。如果实例大部分时间处于空闲状态,则不会总是调用它。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)