简体   繁体   English

如何呈现Google App Engine模板?

[英]How to render a Google App Engine template?

I know you can render a template by using something like: 我知道您可以使用以下内容渲染模板:

    template_values = {
        'contacts': contacts,
        'url': url,
        'url_linktext': url_linktext,
    }

    path = os.path.join(os.path.dirname(__file__), 'index.html')        
    self.response.out.write(template.render(path, template_values))

My question is, how would I render a template ('addcontact.html) if it's just a simple form used to capture data? 我的问题是,如果它只是一个用于捕获数据的简单表单,我将如何呈现模板('addcontact.html)?

Thanks! 谢谢!

the template.render accept 2 arguments , when there is no values to pass just use this {} template.render接受2个参数,当没有值传递时只使用这个{}

so it will be template.render(templatefile , {}) 所以它将是template.render(templatefile,{})

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM