import os
from google.appengine.ext import webapp
from google.appengine.ext.webapp import template
# Utility function for rendering template files
def do_render(handler, template_file, vals = {}, template_dir = 'templates/'):
# Create full path to file
path = os.path.join(os.path.join(os.path.dirname(__file__), template_dir), template_file)
# Write out the content
handler.response.out.write(template.render(path, vals))
I’m actually not sure why I posted this small codesnippet here, but it’s from a small Google Appengine project that I have been working on.
It’s a great function for rendering templates (I think it’s the django way) using Google Appengine