djangoforbeginners
djangoforbeginners copied to clipboard
chapter 3- Pages app-TemplateDoesNotExist at / home.html
I am getting the error 'TemplateDoesNotExist at / home.html' with the following TEMPLATE setting in settings.py TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [BASE_DIR / 'templates'],
The template folder is in project level. Can you please help ?
Hey Uncle,
I am using the 3.1 edition book, and this is what I do. Move your template folder up 1. I might be reading your files wrong, but I do not nest the template folder in the Django config folder. I added a random project example. Hope it helps
'DIRS': [str(BASE_DIR.joinpath('templates'))],
,
How will it look in the Pages app, chapter 3.Have you placed the templates folder in the app or project folder? I does not work for me from the project folder
Hey Uncle,
Once again, my advice is based on what I did in 3.1 so I can't speak on behalf of chapter 3, for the 4.0 book. The template folder should be in your Top Root Project folder called "PAGES. From what I can tell in the screenshot you have it nested inside "Django_project" which looks like your Django config settings. You can trying taking it out and moving it up 1 directory. It will sit next to your "Django_project" Folder
So try moving templates folder up 1 directory, and then use 'DIRS': [str(BASE_DIR.joinpath('templates'))],
I'm closing this now. The correct answer is provided by @susbot. The later versions of the book use django_project in place of config but the key is that the templates directory be at the project-level as @susbot shows in the screen shot.