Django:Django-注册密码重置错误

我刚刚安装了Django-Registration应用程序,除了我无法弄清楚密码重置方法之外我还能正常工作 . 每当我导航到帐户/密码/重置/我收到以下错误:

使用参数'()'和关键字参数'{}'找不到'password_reset_done' . 0模式试过:[]任何想法? django-registration网址有问题吗?

更新:

我在上一篇文章中添加了以下代码行:Django 1.6和django-registration:内置的身份验证视图未被提取

进入我的注册/后台/默认/ urls.py

url(r'^password/change/$',
                           auth_views.password_change,
                           name='password_change'),
                       url(r'^password/change/done/$',
                           auth_views.password_change_done,
                           name='password_change_done'),
                       url(r'^password/reset/$',
                           auth_views.password_reset,
                           name='password_reset'),
                       url(r'^password/reset/done/$',
                           auth_views.password_reset_done,
                           name='password_reset_done'),
                       url(r'^password/reset/complete/$',
                           auth_views.password_reset_complete,
                           name='password_reset_complete'),
                       url(r'^password/reset/confirm/(?P<uidb64>[0-9A-Za-z]+)-(?P<token>.+)/$',
                           auth_views.password_reset_confirm,
                           name='password_reset_confirm'),

                      #and now add the registration urls
                       url(r'', include('registration.backends.default.urls')),

然后我添加了以下导入:

from django.contrib.auth import views as auth_views

但是当我在服务器重启后运行程序时,我收到以下错误消息:

异常类型:RuntimeError异常值:调用Python对象时超出最大递归深度异常位置:/home/ubuntu/django-skippl/local/lib/python2.7/site-packages/Django-1.6.2- py2.7 init中的.egg / django / utils / datastructures.py,第287行Python可执行文件:/ home / ubuntu / django-skippl / bin / python

回答(2)

3 years ago

试试这个urls.py

import os

from django.contrib.auth import views as auth_views
from django.conf.urls import patterns, include, url
from django.conf import settings

from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
    url(r'^accounts/', include('registration.backends.default.urls')),

    #override the default urls
    url(r'^password/change/$',
                auth_views.password_change,
                name='password_change'),
    url(r'^password/change/done/$',
                auth_views.password_change_done,
                name='password_change_done'),
    url(r'^password/reset/$',
                auth_views.password_reset,
                name='password_reset'),
    url(r'^password/reset/done/$',
                auth_views.password_reset_done,
                name='password_reset_done'),
    url(r'^password/reset/complete/$',
                auth_views.password_reset_complete,
                name='password_reset_complete'),
    url(r'^password/reset/confirm/(?P<uidb64>[0-9A-Za-z]+)-(?P<token>.+)/$',
                auth_views.password_reset_confirm,
                name='password_reset_confirm'),

    url(r'^admin/', include(admin.site.urls)),
)

3 years ago

这应该工作:

url(r'^accounts/', include('registration.backends.simple.urls')),

url(r'^accounts/password/reset/done/$', 'django.contrib.auth.views.password_reset_done',
   name='password_reset_done'),