20π
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')],
...
2π
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.
- How can I disable a model field in a django form
- Django __call__() missing 1 required keyword-only argument: 'manager'
0π
I had exactly that problem, base.html not found in my_project/templates/base.html.
I fixed it moving the directory templates just after the app that calls it
(before buggy)
--my_project
--templates
--app_a
(after fixed)
--my_project
--app_a
--templates
- Django @csrf_exempt not working in class View
- Error: command 'x86_64-linux-gnu-gcc' when installing mysqlclient
- Django: Password reset email subject line contains 'example.com
- How can I automatically let syncdb add a column (no full migration needed)
-4π
Set your template path in DIR [] of settings.py
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [**'C:\\Python27\\Lib\\site-packages\\django\\contrib\\admin\\templates\\admin'**],
'APP_DIRS':True,
'OPTIONS': {
- How to test (using unittest) the HTML output of a Django view?
- Getting the request origin in a Django request
- Django admin many-to-many intermediary models using through= and filter_horizontal
- Advanced Django Template Logic
- Django QuerySet Custom Ordering by ID