简体   繁体   中英

Django having issues with django-registration-redux

I've been following an online tutorial on django registration. They are using django-registration-redux==1.1 , and I have to use django-registration-redux==1.4 . I start my local server and go to this: http://127.0.0.1:8000/accounts/register/

I then see this error: TemplateDoesNotExist at /accounts/register/

Request Method: GET
Request URL: http://127.0.0.1:8000/accounts/register/

Django Version: 1.9
Python Version: 2.7.10
Installed Applications:
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'registration',
 'store']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware']

Template loader postmortem
Django tried loading these templates, in this order:

Using engine django:
    * django.template.loaders.app_directories.Loader: /Library/Python/2.7/site-packages/django/contrib/admin/templates/base.html (Source does not exist)
    * django.template.loaders.app_directories.Loader: /Library/Python/2.7/site-packages/django/contrib/auth/templates/base.html (Source does not exist)
    * django.template.loaders.app_directories.Loader: /Library/Python/2.7/site-packages/registration/templates/base.html (Source does not exist)
    * django.template.loaders.app_directories.Loader: /Users/xx/Desktop/stoneriverelearning/bookstore/store/templates/base.html (Source does not exist)


Template error:
In template /Library/Python/2.7/site-packages/registration/templates/registration/registration_form.html, error at line 1
   base.html   1 :  {% extends "registration/ registration_base.html" %}
   2 : {% load i18n %}
   3 : 
   4 : {% block title %}{% trans "Register for an account" %}{% endblock %}
   5 : 
   6 : {% block content %}
   7 : <form method="post" action="">
   8 :     {% csrf_token %}
   9 :     {{ form.as_p }}
   10 :     <input type="submit" value="{% trans 'Submit' %}" />
   11 : </form>


Traceback:

File "/Library/Python/2.7/site-packages/django/core/handlers/base.py" in get_response
  174.                     response = self.process_exception_by_middleware(e, request)

File "/Library/Python/2.7/site-packages/django/core/handlers/base.py" in get_response
  172.                     response = response.render()

File "/Library/Python/2.7/site-packages/django/template/response.py" in render
  160.             self.content = self.rendered_content

File "/Library/Python/2.7/site-packages/django/template/response.py" in rendered_content
  137.         content = template.render(context, self._request)

File "/Library/Python/2.7/site-packages/django/template/backends/django.py" in render
  97.             reraise(exc, self.backend)

File "/Library/Python/2.7/site-packages/django/template/backends/django.py" in reraise
  107.     six.reraise(exc.__class__, new, sys.exc_info()[2])

File "/Library/Python/2.7/site-packages/django/template/backends/django.py" in render
  95.             return self.template.render(context)

File "/Library/Python/2.7/site-packages/django/template/base.py" in render
  206.                     return self._render(context)

File "/Library/Python/2.7/site-packages/django/template/base.py" in _render
  197.         return self.nodelist.render(context)

File "/Library/Python/2.7/site-packages/django/template/base.py" in render
  988.                 bit = node.render_annotated(context)

File "/Library/Python/2.7/site-packages/django/template/base.py" in render_annotated
  955.             return self.render(context)

File "/Library/Python/2.7/site-packages/django/template/loader_tags.py" in render
  173.         return compiled_parent._render(context)

File "/Library/Python/2.7/site-packages/django/template/base.py" in _render
  197.         return self.nodelist.render(context)

File "/Library/Python/2.7/site-packages/django/template/base.py" in render
  988.                 bit = node.render_annotated(context)

File "/Library/Python/2.7/site-packages/django/template/base.py" in render_annotated
  955.             return self.render(context)

File "/Library/Python/2.7/site-packages/django/template/loader_tags.py" in render
  151.         compiled_parent = self.get_parent(context)

File "/Library/Python/2.7/site-packages/django/template/loader_tags.py" in get_parent
  148.         return self.find_template(parent, context)

File "/Library/Python/2.7/site-packages/django/template/loader_tags.py" in find_template
  128.             template_name, skip=history,

File "/Library/Python/2.7/site-packages/django/template/engine.py" in find_template
  169.         raise TemplateDoesNotExist(name, tried=tried)

Exception Type: TemplateDoesNotExist at /accounts/register/
Exception Value: base.html

I'm getting that the difference would be that I have to do something different in this newer version to get it to find all the new registration html files and txt files (for email), but how do I do this?

EDIT:

So thanks for pointing out the space here:

{% extends "registration/ registration_base.html" %}

How can this be removed? I don't have this in my code that I know of.

Here is my urls file:

from django.conf.urls import include, url
from django.contrib import admin

urlpatterns = [
    url(r'^store/', include('store.urls'), name='store'),
    url(r'^accounts/', include('registration.backends.default.urls')),
    url(r'^admin/', include(admin.site.urls)),

]

Thanks :)

It looks like you have a space in line 1 of your template when referencing the file name. If that's not it, you may have another folder locally named registration that django is looking in instead of the registration package.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM