def render(template_path, template_dict, debug=False):
"""Renders the template at the given path with the given dict of values.
Example usage:
render("templates/index.html", {"name": "Bret", "values": [1, 2, 3]})
Args:
template_path: path to a Django template
template_dict: dictionary of values to apply to the template
Returns:
The rendered template as a string.
"""
if os.environ.get('APPENGINE_RUNTIME') == 'python27':
warnings.warn(_PYTHON27_DEPRECATION, DeprecationWarning, stacklevel=2)
t = _load_internal_django(template_path, debug)
else:
t = _load_user_django(template_path, debug)
return t.render(Context(template_dict))
评论列表
文章目录