def __init__(self, app):
self.app = app
env = get_env(app)
if env is None:
text = ("Template engine is not initialized, "
"call aiohttp_jinja2.setup(...) first"
"")
# in order to see meaningful exception message both: on console
# output and rendered page we add same message to *reason* and
# *text* arguments.
raise web.HTTPInternalServerError(reason=text, text=text)
self._set_asset_paths(app)
# We only want to refresh the webpack stats in development mode,
# not everyone sets this setting, so let's assume it's production.
if app.settings.DEBUG:
app.on_response_prepare.append(self._refresh_webpack_stats)
env.globals['asset_url_for'] = self.asset_url_for
评论列表
文章目录