有人可以举例说明预热入站服务如何在 Google App Engine 的 python 运行时中工作吗?
我读过这个: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 仅在您的应用程序上有一些持续流量时才发送预热请求。如果实例大部分处于空闲状态,它不会总是被调用。
关于python - 预热服务如何在 python google app engine 中工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8235716/