在Html文件中包含Html文件,该文件使用python中的jinja显示在静态文件夹中

在Html文件中包含Html文件,该文件使用python中的jinja显示在静态文件夹中,python,html,jinja2,Python,Html,Jinja2,我想使用jinja将Html文件包含在Html文件中 以下是我的Python代码: @app.route('/sample') def sample(): return render_template('sample1.html') 这是我的sample1.html: <html> <head> <title>KrisHnA Creations</title> <meta name="viewport" cont

我想使用jinja将Html文件包含在Html文件中
以下是我的Python代码:

@app.route('/sample')
def sample():
    return render_template('sample1.html')
这是我的sample1.html:

<html>
<head>
<title>KrisHnA Creations</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
</head>
<body>
      {% include '/static/myfile.html'   %}
有人知道这个解决方案吗??

请回答我

您可以在
sample()
中阅读
myfile.html
,并将html作为参数
render_模板('sample1.html',data=html_from_文件)
发送,然后在模板中您必须使用
{data | safe}
好的,谢谢
jinja2.exceptions.TemplateNotFound: /static/myfile.html