TemplateDoesNotExist at / template not defined

I have tried to set-up my first simple CBV in Django but despite reading literally all related information and trying out all possible path options to my index.html I receive the same message from above. Last version follows:

Python-Version: 3.9.13 Django: 4.1


from django.urls import path
from core.views import Servicelist

urlpatterns = [
path('', Servicelist.as_view(), name='service')


from core.models import Item
from django.views.generic.list import ListView

class Servicelist(ListView):
    model = Item
    context_object_name = "items"

    I receive message that index is not defined Pylance(reportundefinedVariable)




          "BACKEND": "django.template.backends.django.DjangoTemplates",
          "DIRS": [BASE_DIR/'core/templates/paraticosmetics/'],
          "APP_DIRS": True,

Is your app called 'paraticosmetics'? Try adding that to your INSTALLED_APPS list



This line might be them problem you need = (a variable assignment) instead of : ( a type definition )

If not, show us the values of BASE_DIR, TEMPLATES and your project's directory structure.

Back to Top