django error TemplateDoesNotExist
Try putting the template inside a subdirectory:
<project>/<app>/templates/<app>/hello.html
and
return render_to_response('<app>/hello.html', locals())
If you want to access templates inside <project>/templates
then you have to specify DIRS
inside TEMPLATES
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates'),],
'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',
],
},
},
]
Your problem is with your settings. You currently have:
TEMPLATE_DIRS = (
os.path.join(BASE_DIR, 'templates'),
)
This is how you set up template directories in Django 1.7.x and below. In Django 1.8.x, change your TEMPLATES [] to read like this:
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
os.path.join(BASE_DIR, 'templates'),
],
'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',
],
},
},
]
Thank you for being so thorough with your question. Good luck!