【发布时间】:2018-02-03 00:33:13
【问题描述】:
我有一个 django 应用程序和一个主页视图,我想在主页上使用静态 html 文件。我的文件结构是这样的:
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 这是服务器向我抛出的错误:pastebin.com/5CwXvAZA
标签: python html django templates views