0

当新实例在 GAE 上启动时,我的页面呈现双倍状态字符串。

像这样 GAE 上的页面输出翻倍

加载实例后,一切正常。

如何防止实例启动时输出加倍?

代码 id 尽可能简单

class IndexHandler(BaseHandler):
    def get(self):
        context = {'message': 'Wellcome to the NailedGames',
                   'page_description': 'Some blabla',
                   'ngames': NGame.all().order('-publish_date')}
        self.render_response('ngames/index.html', **context)

以及 BaseHandler 的代码

import webapp2
from webapp2_extras import jinja2

class BaseHandler(webapp2.RequestHandler):
    @webapp2.cached_property
    def jinja2(self):
        # Returns a Jinja2 renderer cached in the app registry.
        return jinja2.get_jinja2(app=self.app)

    def render_response(self, _template, **context):
        # Renders a template and writes the result to the response.
        rv = self.jinja2.render_template(_template, **context)
        self.response.write(rv)
4

0 回答 0