winston_smith
winston_smith

Reputation: 67

django : TemplateDoesNotExist

I have the "TemplateDoesNotExist" error. I already read severals answers about this problem, but it still does not work. There is some part of my settings.py file :

import os


BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

fews lines after :

TEMPLATES = [
{
    'BACKEND': 'django.template.backends.django.DjangoTemplates',
    'DIRS': ["os.path.join(BASE_DIR, 'templates')"],
    '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',
        ],
    },
},]

and this

TEMPLATE_DIRS = (
"/home/sarfraz/django/crepes_bretonnes/templates/", )

can somebody help me ? Thanks

Upvotes: 0

Views: 135

Answers (1)

alecxe
alecxe

Reputation: 473873

You are putting the code that meant to be executed in a string. Replace:

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

with:

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

Upvotes: 4

Related Questions