gpt4 book ai didi

python - 如何呈现 Google App Engine 模板?

转载 作者:行者123 更新时间:2023-11-28 16:53:04 25 4
gpt4 key购买 nike

我知道您可以使用类似以下内容呈现模板:

    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))

我的问题是,如果模板 ('addcontact.html) 只是用于捕获数据的简单表单,我将如何呈现它?

谢谢!

最佳答案

template.render 接受 2 个参数,当没有值要传递时就使用这个{}

所以它将是 template.render(templatefile , {})

关于python - 如何呈现 Google App Engine 模板?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4703031/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com