4
votes

I am trying to create a login page in my django application. I created a "templates" folder on the root directory of my application.

Then on my settings.py I wrote this code.

TEMPLATE_DIRS = (os.path.join(BASE_DIR,'templates'),)

And it is giving this feedback:

TemplateDoesNotExist at /login/ Template-loader postmortem

Django tried loading these templates, in this order: Using loader django.template.loaders.filesystem.Loader: Using loader django.template.loaders.app_directories.Loader: /Users/julianasakae/Desktop/DjangoProject/demo/lib/python3.4/site-packages/django/contrib/admin/templates/login.html (File does not exist) /Users/julianasakae/Desktop/DjangoProject/demo/lib/python3.4/site-packages/django/contrib/auth/templates/login.html (File does not exist) /Users/julianasakae/Desktop/DjangoProject/boardgames/main/templates/login.html (File does not exist)

I tryed everything, it does not seems to work.

Any suggestions?

2
Please update your question and add the complete error message.Burhan Khalid
add print TEMPLATE_DIRS right after the line of the setting and run your server to see where it points to.Cheng

2 Answers

4
votes

What version of Django are you using? It appears that TEMPLATE_DIRS was used prior to 1.8 but in the current version it has changed to a DIRS option in the TEMPLATES setting.

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [
            '/home/html/templates/lawrence.com',
            '/home/html/templates/default',
        ],
    },
] 

Template DIRS Option Docs

0
votes

Well it is not a good solution, but try hardcoding the full path.