Jaka jest preferowana metoda korzystania z jinja2 na App Engine?

Pierwotnie zaimplementowałem Jinja2 w App Engine, korzystając z przykładów pokazanych w witrynie App Engine tutaj:https://developers.google.com/appengine/docs/python/gettingstartedpython27/templates gdzie jinja2 jest importowane bezpośrednio:

import jinja2
import os

jinja_environment = jinja2.Environment(
    loader=jinja2.FileSystemLoader(os.path.dirname(__file__)))

class MainPage(webapp2.RequestHandler):
    def get(self):
        greetings = 'somestring'
        template_values = {
            'greetings': greetings,
        }
        template = jinja_environment.get_template('index.html')
        self.response.out.write(template.render(template_values))

Ale obecnie skupiam się na Simpleauth (https://github.com/crhym3/simpleauth) co następuje po wdrożeniu opisanym przez Nicka Johnsona:http://blog.notdot.net/2011/11/Migrating-to-Python-2-7-part-2-Webapp-and-templates gdzie import jinja2 z webapp2_extras:

import os
import webapp2
from webapp2_extras import jinja2

class BaseHandler(webapp2.RequestHandler):
  @webapp2.cached_property
  def jinja2(self):
        return jinja2.get_jinja2(app=self.app)

  def render_template(self, filename, **template_args):
        self.response.write(self.jinja2.render_template(filename, **template_args))

class IndexHandler(BaseHandler):
  def get(self):
    self.render_template('index.html', name=self.request.get('name'))

Która z nich jest preferowaną metodą używania jinja2? (Wydaje się, że nie grają razem dobrze i woleliby standaryzować najlepsze opcje.)

questionAnswers(4)

yourAnswerToTheQuestion