Django templates path change problem Django 4.1.1

Viewed 21

enter image description here

i am new in Django i want change my Django Template path . but they are set by dafault a path in setting.py then i import os but it will not working

1 Answers

I understand you want to change the directory for templates, then do the following. Override variable and path to search for templates:

BASE_DIR = Path(__file__).resolve().parent.parent

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [BASE_DIR / 'Templates'], # change this
        'APP_DIRS': False, #false only if you don't use it
        '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',
            ],
        },
    },
]
Related