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文件放入其中即可。

posted @ 2022-03-27 09:36  三水一人山  阅读(1475)  评论(0编辑  收藏  举报