mrXomebody
mrXomebody

Reputation: 1

I have been trying to runserver for my code but I keep getting this error

I'm trying to create a website using django but each time I runserver i keep getting this error message:

TemplateDoesNotExist at /
base.html
Request Method: GET
Request URL:    http://127.0.0.1:8000/
Django Version: 5.0.2
Exception Type: TemplateDoesNotExist
Exception Value:    
base.html
Exception Location: C:\Users\Admin\KredibleConstructionWebsite\venv\lib\site-packages\django\template\backends\django.py, line 84, in reraise
Raised during:  main.views.home
Python Executable:  C:\Users\Admin\KredibleConstructionWebsite\venv\Scripts\python.exe
Python Version: 3.10.11
Python Path:    
['C:\\Users\\Admin\\KredibleConstructionWebsite\\kredibleconstruction',
 'C:\\Program '
 'Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\\python310.zip',
 'C:\\Program '
 'Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\\DLLs',
 'C:\\Program '
 'Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\\lib',
 'C:\\Users\\Admin\\AppData\\Local\\Microsoft\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0',
 'C:\\Users\\Admin\\KredibleConstructionWebsite\\venv',
 'C:\\Users\\Admin\\KredibleConstructionWebsite\\venv\\lib\\site-packages']
Server time:    Tue, 20 Feb 2024 09:17:47 +0000
Template-loader postmortem
Django tried loading these templates, in this order:

Using engine django:

django.template.loaders.filesystem.Loader: C:\Users\Admin\KredibleConstructionWebsite\kredibleconstruction\main\templates\base.html (Source does not exist)
django.template.loaders.app_directories.Loader: C:\Users\Admin\KredibleConstructionWebsite\venv\lib\site-packages\django\contrib\admin\templates\base.html (Source does not exist)
django.template.loaders.app_directories.Loader: C:\Users\Admin\KredibleConstructionWebsite\venv\lib\site-packages\django\contrib\auth\templates\base.html (Source does not exist)
django.template.loaders.app_directories.Loader: C:\Users\Admin\KredibleConstructionWebsite\kredibleconstruction\main\templates\base.html (Source does not exist)
Error during template rendering
In template C:\Users\Admin\KredibleConstructionWebsite\kredibleconstruction\main\templates\main\home.html, error at line 3

What can I do to resolve this? I have corrected the base.html file mutliple times and even changed the directory to templates\main\bas.html but it is not working

Upvotes: 0

Views: 41

Answers (1)

turalmehrali
turalmehrali

Reputation: 343

Update your DIRS path in TEMPLATES configuration. It should be:

'DIRS': [BASE_DIR / 'templates'],

Upvotes: 0

Related Questions