我有一個django應用程序和主頁的視圖,我想在主頁上使用靜態html文件。我的文件結構是這樣的:Django:將靜態html文件傳遞到視圖中會產生TemplateDoesNotExist錯誤
project/
stats (this is my app)/
urls.py
views.py
stats.html
(other files here)
在我的views.py我有以下代碼:
from django.shortcuts import render_to_response
def index(request):
return render_to_response('stats.html')
當我運行的網址,我只是索引頁。我進入統計頁面,收到TemplateDoesNotExist
錯誤。尋找答案我試圖把stats/stats.html
而不是路徑,但我仍然得到相同的錯誤。這樣做的正確方法是什麼?
請發佈完整的錯誤 – csling
@csling這是服務器對我發出的錯誤:https://pastebin.com/5CwXvAZA – PolarBearITS