Python 如何在Flask中的页面上显示html文件
我试图将我的报告呈现到页面上,但是html代码显示的不是实际的对象,我如何显示该对象Python 如何在Flask中的页面上显示html文件,python,pandas,flask,Python,Pandas,Flask,我试图将我的报告呈现到页面上,但是html代码显示的不是实际的对象,我如何显示该对象 profile = pp.ProfileReport(df, check_correlation=False) return render_template('profile.html', my_bucket=my_bucket, profile=profile.to_html()) 将{{profile | safe}}}添加到我的代码中修复了这个问题,因为它现在在模板中呈现概要文件,感谢@abdou编辑
profile = pp.ProfileReport(df, check_correlation=False)
return render_template('profile.html', my_bucket=my_bucket, profile=profile.to_html())
将
{{profile | safe}}}
添加到我的代码中修复了这个问题,因为它现在在模板中呈现概要文件,感谢@abdou编辑profile.html
模板,以确保它显示{profile | safe}
。这将在模板内呈现配置文件。Flask将在计算机上的模板
文件夹中查找HTML文件。因此,当您调用render_template时,它会在那里检查您的文件。您可能希望尝试profile.to_file()
并编写一个文件,如果无法使其正常工作,则可以在render_tempalate
中引用该文件作为解决方法。