TemplateDoesNotExist at / base.html

I had same problem first I tried to solve it with adding path to shortcuts of HTML templates {% extends "base.html" %} to {% extends "foldername/template/base.html" %} it did not work.

After that I add to 'base.html' file in every projects templates folder. It worked for me.


I'm not familiar with the book you are using, so I can't give you any advice based on that. If the book is for Django 1.7, you will find it easier to use Django 1.7 instead of Django 1.8, at least when you are beginning with Django.

If you want to stick with Django 1.8, here's how to fix the error you are currently seeing:

Your settings.py file has a mixture of old templates settings, like TEMPLATE_DIRS and TEMPLATE_LOADERS (Django <= 1.7), and the new settings under TEMPLATES (Django 1.8+).

First, remove the old settings TEMPLATE_DIRS and TEMPLATE_LOADERS.

Secondly, it looks as if DIRS is incorrect in your TEMPLATES setting.

Define BASE_DIR, which should be included in settings.py by default when you run ./manage.py startproject

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

Then change TEMPLATES to

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [os.path.join(BASE_DIR, 'templates')],
        ...

Tags:

Python

Django