template.py 文件源码

python
阅读 29 收藏 0 点赞 0 评论 0

项目:Deploy_XXNET_Server 作者: jzp820927 项目源码 文件源码
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))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号