jinja2.exceptions.TemplateNotFound: index.html


jinja2.exceptions.TemplateNotFound: index.html

现象

GET /index HTTP/1.1" 500 内部服务器错误
return render_template(“index.html”) #调用模块index
jinja2.exceptions.TemplateNotFound: index.html
没有找到index.html文件

原因

由于reder_template查找目录是在当前目录中查找templates,我创建的templates文件夹不在当前目录中,因此找不到index.html文件。

解决方法

此程序所在目录下创建一个templates文件夹,将index,html文件放入其中即可。


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM