我的Django的模板位置被列爲:TemplateDoesNotExist Django的
python\Lib\site-packages\django\contrib\auth\templates
在我看來,我有:
當我繼續在此位置hello.html
它的工作
python\Lib\site-packages\django\contrib\auth\templates
雖然我保留模板位置爲
TEMPLATE_DIRS = (
os.path.join(os.path.dirname(__file__), 'templates'),
)
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
NewProject
-NewProject
settings.py
-signups
view.py
def hello(request):
name='vijay'
return render_to_response('hello.html',{'name':name})
templates
hello.html
而不是說不起作用,爲什麼你不仔細看堆棧跟蹤看看它說什麼,如果你需要幫助,將它添加到問題。 – e4c5
@ user1844634什麼是django版本? –
我正在使用1.8.4 – user1844634