1. 程式人生 > >Django中Template does not exit

Django中Template does not exit

info bubuko set 就會 AS http 技術分享 In Go

在template下新建了一個html文件,運行時一直報錯

技術分享圖片

原因是,在運行時django一直在找自己默認路徑下的模板,找不到我自己建的html文件

在settings.py中添加如下代碼:

TEMPLATE_DIRS = (
os.path.join(BASE_DIR, ‘templates‘).replace(‘\\‘, ‘/‘),
)
就會發現運行成功了。

Django中Template does not exit