Javascript jinja2错误';用户未定义';当试图将python文件中的细节引入html文档时,我的代码有什么问题?
这是我想要测试的东西,看看它是否有效,因为我对html的概念还不熟悉 因此,我从网上为我的Javascript jinja2错误';用户未定义';当试图将python文件中的细节引入html文档时,我的代码有什么问题?,javascript,python,html,css,jinja2,Javascript,Python,Html,Css,Jinja2,这是我想要测试的东西,看看它是否有效,因为我对html的概念还不熟悉 因此,我从网上为我的\uuuu init\uuuu.py文件获取了以下代码: @auth.route("/profile") def profile(): user_details = { 'fname' : 'John' } return render_template('user/profile.html', user = user_details) 我的ht
\uuuu init\uuuu.py
文件获取了以下代码:
@auth.route("/profile")
def profile():
user_details = {
'fname' : 'John'
}
return render_template('user/profile.html', user = user_details)
我的html如下所示(profile.html):
{%extends“admin layout.html”%}
{%block content%}
你的个人资料
名字
姓
电子邮件
电话号码。
年龄
{{user.fname}
{%endblock内容%}
我想做的是在我的网站上,在user.fname
的位置显示John。然而,我得到了jinja2错误,“用户”是未定义的
。怎么了
{% extends "admin-layout.html" %}
{% block content %}
<div class="container">
<div class="card">
<div class="card-header">
<h1>Your Profile</h1>
</div>
</div>
<div class="card-body">
<h5>First Name</h5>
<h5>Last Name</h5>
<h5>Email</h5>
<h5>Phone no.</h5>
<h5>Age</h5>
<h5>{{user.fname}}</h5>
</div>
</div>
{% endblock content %}