Forums

TemplateDoesNotExist Error throwing by django app

Hi, I was trying to host my django web app when i have done all process I received an error which says my templates does not exist something like that

Template-loader postmortem Django tried loading these templates, in this order: Using engine django: django.template.loaders.filesystem.Loader: /home/hanzlaanjum/templates/home.html (Source does not exist) django.template.loaders.app_directories.Loader: /home/hanzlaanjum/.virtualenvs/venv/lib/python3.9/site-packages/django/contrib/admin/templates/home.html (Source does not exist) django.template.loaders.app_directories.Loader: /home/hanzlaanjum/.virtualenvs/venv/lib/python3.9/site-packages/django/contrib/auth/templates/home.html (Source does not exist) Here it says it is looking for templates in hanzlaanjum/templates but this is not my project name I doesn't understand why it's searching for templates in home directory instead of my webapp directory the path to my web app is /home/hanzlaanjum/Portfolio-Web here is my custom Wsgi file I have filled the correct path in the code and everything but why it kept looking for templates in other folders rather than the project folder. Can anyone help me with this problem?

import os import sys path = '/home/hanzlaanjum/Portfolio-Web' if path not in sys.path: sys.path.append(path) os.environ['DJANGO_SETTINGS_MODULE'] = 'PortfolioWeb.settings' from django.core.wsgi import get_wsgi_application application = get_wsgi_application()

What is the structure of your django project?

Template-loader postmortem Django tried loading these templates, in this order:

Using engine django:

django.template.loaders.filesystem.Loader: /home/situ1/daliy_task/todo/todo_app/Templates/index.html (Source does not exist) django.template.loaders.app_directories.Loader: /usr/local/lib/python3.10/site-packages/django/contrib/admin/templates/index.html (Source does not exist) django.template.loaders.app_directories.Loader: /usr/local/lib/python3.10/site-packages/django/contrib/auth/templates/index.html (Source does not exist)

It means that it can't find the file at this path: /home/situ1/daliy_task/todo/todo_app/Templates/index.html

Check your files for this exact path. I'm guessing there's a typo. For example daliy_task might actually be called daily_task?