Home > front end >  templateDoesNotExist at / in django (what settings to do)
templateDoesNotExist at / in django (what settings to do)

Time:09-26

I'm new to django. The error is coming templateDoesNotExist at /

There is one app in my project,I've put the template folder in the app Structure is like: Project_name , manage.py,app_name,SQLite

The structure of the app (app_name): other files... Inside template folder .. (Templates(folder) -> app_name(folder) ->HTML file)

What setting I've to do in settings.py of prj to debug this error.

Did I've to include path of every template of each app. ? Like inside setting.py in Templates

DIRS: ['BASE_DIR', "path"]

CodePudding user response:

======== check & verify this ========
step-1 : check your app is registered or not

step-2: if your [templates] folder is in the app then go with the below setting otherwise put the path of your template in DIRS:['your template directory']

=== this is the default setting for a template if your templates folder in your application folder ===

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

step-3: check in views.py template name is correct or not 
  • Related