这是我的网站网址 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/