I have been following a book called Django5 by example. i am following the blog project in the book and I got it to work before but this time it not working I keep getting a TemplateDoseNotExist error
def post_list(request):
posts = Post.published.all()
return render(request, 'blog/post/list.html', {'posts': posts})
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',
],
},
},
]
The templates folder is here:
You have post/list.html
there, not blog/post/list/html
— if you correct that in your view code, it should find it.
(The normal naming convention would be blog/post_list.html
— but that’s up to you.)