3

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. Commented Apr 23, 2015 at 4:45
  • add print TEMPLATE_DIRS right after the line of the setting and run your server to see where it points to. Commented Apr 23, 2015 at 4:47

2 Answers 2

4

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

Sign up to request clarification or add additional context in comments.

1 Comment

Great job. It was a version problem. Thank you very much. You saved me a lot of time
0

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.