Extend base.html error: TemplateDoesNotExist at /accounts/register/


#1

I’ve hit a snag with Chapter 10 of the book, the following URLs result in a template error:

http://127.0.0.1:8000/accounts/register
http://127.0.0.1:8000/accounts/logout/
http://127.0.0.1:8000/accounts/login/

The error is as follows:

TemplateDoesNotExist at /accounts/login/
base_html
Request Method: GET
Request URL: http://127.0.0.1:8000/accounts/login/
Django Version: 1.9.5
Exception Type: TemplateDoesNotExist
Exception Value:
base_html
Exception Location: /Users/jfreasier/anaconda3/envs/hello/lib/python2.7/site-packages/django/template/engine.py in find_template, line 169
Python Executable: /Users/jfreasier/anaconda3/envs/hello/bin/python
Python Version: 2.7.13
Python Path:
[’/Users/jfreasier/Desktop/Code/web-projects/hello-web-app’,
’/Users/jfreasier/anaconda3/envs/hello/lib/python27.zip’,
’/Users/jfreasier/anaconda3/envs/hello/lib/python2.7’,
’/Users/jfreasier/anaconda3/envs/hello/lib/python2.7/plat-darwin’,
’/Users/jfreasier/anaconda3/envs/hello/lib/python2.7/plat-mac’,
’/Users/jfreasier/anaconda3/envs/hello/lib/python2.7/plat-mac/lib-scriptpackages’,
’/Users/jfreasier/anaconda3/envs/hello/lib/python2.7/lib-tk’,
’/Users/jfreasier/anaconda3/envs/hello/lib/python2.7/lib-old’,
’/Users/jfreasier/anaconda3/envs/hello/lib/python2.7/lib-dynload’,
’/Users/jfreasier/anaconda3/envs/hello/lib/python2.7/site-packages’,
’/Users/jfreasier/anaconda3/envs/hello/lib/python2.7/site-packages/setuptools-27.2.0-py2.7.egg’]
Server time: Tue, 21 Feb 2017 19:10:21 +0000
Template-loader postmortem

Django tried loading these templates, in this order:

Using engine django:
django.template.loaders.app_directories.Loader: /Users/jfreasier/Desktop/Code/web-projects/hello-web-app/collection/templates/base_html (Source does not exist)
django.template.loaders.app_directories.Loader: /Users/jfreasier/anaconda3/envs/hello/lib/python2.7/site-packages/django/contrib/admin/templates/base_html (Source does not exist)
django.template.loaders.app_directories.Loader: /Users/jfreasier/anaconda3/envs/hello/lib/python2.7/site-packages/django/contrib/auth/templates/base_html (Source does not exist)
django.template.loaders.app_directories.Loader: /Users/jfreasier/anaconda3/envs/hello/lib/python2.7/site-packages/registration/templates/base_html (Source does not exist)
Error during template rendering

In template /Users/jfreasier/Desktop/Code/web-projects/hello-web-app/collection/templates/registration/login.html, error at line 1
base_html
1 {% extends ‘base_html’ %}
2 {% block title %}
3 Login - {{ block.super }}
4 {% endblock title %}
5 {% block content %}
6

Login


7
8 {% csrf_token %}
9 {{ form.as_p }}
10
11

I’ve combed through each of the steps in this chapter, and I can’t find anything that I’ve missed or done incorrectly. I am using an anaconda virtual environment instead of virtualenv, but that hasn’t caused me any problems so far in the project, so I don’t see how this could be causing this specific error. I have confirmed that the right version of django-registration-redux package installed. There is absolutely no issue with template rendering for ‘Thing’ html files, so it’s not anything to do with an incorrect file path for base.html file. I’m pretty much at a dead end here, so appreciate your feedback on this.


#2

Looks like in your code you have base_html rather than base.html!


#3

facepalm

Thanks!