[ appengine ] writing the custom template in webapp2

The trick is using django template, not the webapp template.

from django.template.loader import render_to_string

...

render_to_string("template/body.html", {"param1", "val1"})

app.yaml

env_variables:
 DJANGO_SETTINGS_MODULE: 'settings'

settings.py

import os

PROJECT_PATH = os.path.realpath(os.path.dirname(__file__))
TEMPLATE_DIRS = (
PROJECT_PATH
)

main.py

from django.template import add_to_builtins
add_to_builtins('templatetags.whateverTag')
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s