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