Skip to content
This repository
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 24 lines (13 sloc) 0.982 kb
layout title
default
How to use templates on Google App Engine

How to use templates on Google App Engine

Problem

How to use templates on Google App Engine

Solution

web.py templetor compiles the templates to python source, which requires accessing parser module of python standard library. Unfortunately that module is blocked in GAE for security reasons.

To overcome that situation, web.py supports compiling the templates to python code so that the compiled sources can be used on GAE instead of the original templates. web.py makes sure that no code changes are required to use templates in this way.

To compile all templates in a template dir (has to be redone each time a template has changed):

$ python web/template.py --compile templates

This compiles all templates in templates/ dir recursively and creates __init__.py with all the templates in that dir. On GAE, web.template.render is re-written to treat templates/ as python module.

Something went wrong with that request. Please try again.