Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/279.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript jinja2错误';用户未定义';当试图将python文件中的细节引入html文档时,我的代码有什么问题?_Javascript_Python_Html_Css_Jinja2 - Fatal编程技术网

Javascript jinja2错误';用户未定义';当试图将python文件中的细节引入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

这是我想要测试的东西,看看它是否有效,因为我对html的概念还不熟悉

因此,我从网上为我的
\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 %}