Python flask布局模板:配置文件图片未出现在导航栏中

时间:2019-06-18 14:45:47

标签: python flask

Layout.html的一部分将显示用户名和注销选项,但是不会显示个人资料图片。 src没有进行函数调用,该函数将返回配置文件pic路径

layout.html
    <a href="{{ url_for('users.account')}}"> <img  src="{{ url_for    ('get_profile_pic') }}"></a>


    @users.route("/get_profile_pic", methods=['GET', 'POST'])
    def get_profile_pic():
    logged_in_user = users.find_one({'username': current_user.username})
    profile_pic_path = logged_in_user['profile_pic']
    return profile_pic_path

0 个答案:

没有答案