Which is the preferred method to use jinja2 on App Engine?

前端 未结 4 2050
感动是毒
感动是毒 2021-02-20 15:24

I originally implemented Jinja2 on App Engine using the examples shown on the App Engine site here: https://developers.google.com/appengine/docs/python/gettingstartedpython27/te

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-20 16:30

    I guess they are pretty much the same. What webapp2_extras.jinja2 does in addition is that it caches jinja2.Environment() initialization (for the request duration). Plus, you can leverage config/registry system of the webapp2.

    Looking at get_jinja2() source you'll see that it's just a handy wrapper for jinja2.Environment() with some default environment args and enabled extensions (e.g. i18n).

提交回复
热议问题