[Answered ]-Django and Tailwind 'TemplateDoesNotExist' error

1👍

Hey change this line in your settings.py
from this

        'DIRS': ['C:\Users\Kaij\Documents\djangoTests\djangoTailwind2\env\project\main\template'],

to this

 [BASE_DIR/ 'templates']

and then in your main directory create a folder called templates and within that folder create another folder called main and that is where your home.html goes into. so something like this

project -> main -> templates -> home.html

and in your folder called main, create a urls.py and add these lines

from django.urls import path
from .views import some_view_name

urlpatterns = [
    path('', some_view_name, name='home-view')
]

then in main -> views.py add this line to

from django.shortcuts import render
def some_view_name(request):
    return render(request, "main/home.html")

that should some the problem for you.

your directory structure should look like something like this

project 
    -> project
          urls.py
           ...
    -> main
          ->templates
            -> main
                 -> home.html
   manage.py
   ...

If this solves your problem please don’t forget to accept it as the correct answer.

Leave a comment