Djangos TEMPLATE_DIRS not found

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

Then in my I wrote this code.

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

And he gives this feedback:

TemplateDoesNotExist at / login / Postmortem loader template

Django tried to load these templates in the following order: Using the django.template.loaders.filesystem.Loader: Using the django.template.loaders.app_directories.Loader: / Users / julianasakae / Desktop / DjangoProject / demo / lib / python 3.4 / site -packages / django / contrib / admin / templates / login.html (File does not exist) / Users / julianasakae / Desktop / DjangoProject / demo / lib / python 3.4 / site-packages / django / contrib / auth / templates / login.html (The file does not exist) /Users/julianasakae/Desktop/DjangoProject/boardgames/main/templates/login.html( The file does not exist)

I tried everything, it doesn't seem to work.

Any suggestions?


source to share

2 answers

Which version of Django are you using? It looks like it was TEMPLATE_DIRS

used before 1.8, but in the current version it has changed to a parameter DIRS

in setting TEMPLATES


        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [


DIRS documents for templates



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



All Articles