django-templates - 模板不存在于/

标签 django-templates

这是我的网站网址 http://webtrick.heliohost.org/ 我的模板目录设置:

TEMPLATE_DIRS = (
    os.path.join(os.path.dirname(__file__) , 'templates').replace('\\','/')
)

View .py

from django.http import HttpResponse
from django.template import Template , Context
from django.shortcuts import render_to_response
def index(request):
        return render_to_response('index.html')

url.py

from django.conf.urls.defaults import patterns, include, url
from webtrickster.views import index
urlpatterns = patterns('',
    url(r'^$', index)
)

我不知道这段代码有什么问题 感谢任何帮助

最佳答案

确保您的 Django 应用程序位于 settings.py 中的 INSTALLED_APPS 中。那是我的问题。因此,如果您的民意调查应用程序文件夹中有 templates 文件夹,则需要在设置文件中已安装应用程序的末尾添加“民意调查”。

关于django-templates - 模板不存在于/,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5686044/

相关文章:

python - 在 Django 中注册自定义过滤器

python - 如何在 Django 模板上下文中获取 "debug"变量?

django-templates - 如何在不使用过滤器的情况下舍入 django 模板中的值

django - 如何使用 Django 模板检查多个值?

python - 在外键上缓存 Django SQL 查询

jquery - Django,类别和子类别

html - bootstrap 3 将文本内容包装在 div 中以进行水平对齐

Django 模板 - 更改 'include' 模板的上下文

django - 在 Django 网站上上传和显示视频

python - Django:使用非模型数据时如何预填充表单?