So, i'm developing this app in python and when i try to show some html in the browser i get this error:
TemplateDoesNotExist at /xPharma/hello/ hello.html Request Method: GET Request URL: http://127.0.0.1:8000/xPharma/hello/ Django Version: 4.2.11 Exception Type: TemplateDoesNotExist Exception Value: hello.html Exception Location: C:\Users\Marco\.virtualenvs\XpharmBackend-9gJJ8jLG\lib\site-packages\django\template\loader.py, line 19, in get_template Raised during: xPharma.views.say_hello Python Executable: C: \Users\Marco\.virtualenvs\XpharmBackend-9gJJ8jLG\Scripts\python.exe Python Version: 3.9.7 Python Path: ['C:\\Users\\Marco\\Desktop\\Desktop\\progetto X pharme\\XpharmBackend','C:\\Python39\\python39.zip','C:\\Python39\\DLLs','C:\\Python39\\lib','C:\\Python39','C:\\Users\\Marco\\.virtualenvs\\XpharmBackend-9gJJ8jLG','C:\\Users\\Marco\\.virtualenvs\\XpharmBackend-9gJJ8jLG\\lib\\site-packages'] Server time: Mon, 01 Apr 2024 15:44:22 +0000
but i find out that i get this error because python is searching for a file in the wrong directory...
Using engine django:django.template.loaders.app_directories.Loader: C:\Users\Marco\.virtualenvs\XpharmBackend-9gJJ8jLG\lib\site-packages\django\contrib\admin\templates\hello.html (Source does not exist)django.template.loaders.app_directories.Loader: C:\Users\Marco\.virtualenvs\XpharmBackend-9gJJ8jLG\lib\site-packages\django\contrib\auth\templates\hello.html (Source does not exist)
Is there a way to change this directories and redirect python to where i saved my file?
EDIT: As requested here's my views.py (xPharma.views.say_hello):
from django.shortcuts import renderfrom django.http import HttpResponsedef say_hello(request): return render(request,'hello.html')