Search code examples
pythondjangodjango-viewsdjango-templates

TemplateDoesNotExist at / (Django)


Trying to my create a home page, with django. I keep running into a TemplateDoesNotExist at error. Im pretty sure it has something to do with my paths set up. I havent worked with django enough to debug this :( urls.py in a directory I made views.py in a directory I made Original views in ll_project folder

Im trying to display an index.html fileindex

My directory with all the files in themdirectory


Solution

  • Your index.html is in the wrong directory. To fix this error, create a folder named templates in your app directory (i.e. learning_logs). In the templates folder, create another folder named learning_logs and put your index.html file there. So your path should look like this: learning_logs\templates\learning_logs\index.html

    This is assuming you left the default TEMPLATES setting in your settings.py. See https://docs.djangoproject.com/en/5.0/ref/settings/#templates