热身服务如何在Python谷歌应用程序引擎中工作? [英] How does the warmup service work in python google app engine?
问题描述
有人可以举例说明热身入站服务如何在Google App Engine的python运行时中工作吗? http://code.google.com/appengine/docs/python/config/appconfig。 html#Inbound_Services ,但是在GET请求发送后我没有给出很多示例(我似乎无法捡起它)
我的app.yaml如下所示:
application:whatevs
版本:1
runtime: python
api_version:1
builtins:
- datastore_admin:在
入站服务:
- 预热
处理程序:
- url:/ static
static_dir:static
- url:/ _ah / warmup
脚本:main.py
登录名:admin
- url:/.*
script:main.py
我的main.py看起来像这样:
def main():
ap plication = webapp.WSGIApplication(
[(/,views.LandingPage),
(/ _ah / warmup,views.WarmupHandler)
],
debug = True )
run_wsgi_app(应用程序)
WarmupHandler如下所示:
class WarmupHandler(webapp.RequestHandler):
在app init中调用
def get(self):
current_user = users.get_current_user()
return
<然而,WarmupHandler似乎永远不会被调用(我有断点和大量的调试代码)。我做错了什么?
App Engine仅在您的应用程序中存在一些持续流量时发送预热请求。如果实例大多处于空闲状态,它将不会总是被调用。
Can someone give an example of how the warmup inbound service works in the python runtime of Google App Engine?
I've read this: http://code.google.com/appengine/docs/python/config/appconfig.html#Inbound_Services, but it doesn't give me much of an example after the GET request is sent (I can't seem to ever pick it up)
My app.yaml looks like this:
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
my main.py looks like this:
def main():
application = webapp.WSGIApplication(
[("/", views.LandingPage),
("/_ah/warmup", views.WarmupHandler)
],
debug=True)
run_wsgi_app(application)
WarmupHandler looks like this:
class WarmupHandler(webapp.RequestHandler):
"""
Called on app init
"""
def get(self):
current_user = users.get_current_user()
return
However, WarmupHandler never seems to get called (I have breakpoints and lots of debug code). What am I doing wrong?
App Engine sends warm up requests only if there is some constant traffic on your app. It won't get always called if instances stand mostly idle.
这篇关于热身服务如何在Python谷歌应用程序引擎中工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!