Answers for "TEMPLATE_DIR = os.path.join(BASE_DIR,'templates')"

0

'DIRS': [os.path.join(BASE_DIR, 'templates')],

Incorrect syntax in polls app tutorial by Django

Use this: 
os.path.join(BASE_DIR, 'templates')

instead of this:
BASE_DIR / 'templates'

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [os.path.join(BASE_DIR, 'templates')],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                # codes...
            ],
        },
    },
]
Posted by: Guest on November-22-2020
1

'DIRS': [os.path.join(BASE_DIR,'template')],

BASE_DIR /"challenges"/"templates" 

'challenges' is the app name, it will automatically look for the app name and the
 folder inside naming 'templates'

And if all the template and static files are in app folder, then you only need to 
register the app in setting.py, Under the hood, django will autoamtically lookup for
the file named template and static in that app folder
Posted by: Guest on June-01-2021

Code answers related to "TEMPLATE_DIR = os.path.join(BASE_DIR,'templates')"

Python Answers by Framework

Browse Popular Code Answers by Language