Python 烧瓶渲染模板
我尝试将数据插入我的模板render_模板Python 烧瓶渲染模板,python,flask,jinja2,Python,Flask,Jinja2,我尝试将数据插入我的模板render_模板 data = Bill.bill_data(self) return render_template('templates/bill.html', **data) 票据模板在文件夹模板中的位置。但我有这个错误 jinja2.exceptions.TemplateNotFound: templates/bill.html 我的数据如下所示: data={ "payer_currency": "5", "
data = Bill.bill_data(self)
return render_template('templates/bill.html', **data)
票据模板在文件夹模板中的位置。但我有这个错误
jinja2.exceptions.TemplateNotFound: templates/bill.html
我的数据如下所示:
data={
"payer_currency": "5",
"shop_amount": "5",
"shop_currency": "5",
"shop_id": "5",
"shop_order_id": "12",
"sign": ""
}
您不必在路径中添加
模板/
。默认情况下,render\u template
在文件夹templates
return render_template('bill.html', **data)
“/templates/bill.html”可能会起作用?您不必在path中添加
模板/
——默认情况下,它会在文件夹模板
中搜索。