密码重置激活电子邮件在Django中不起作用

密码重置激活电子邮件在Django中不起作用

本文介绍了No ReverseMatch:密码重置激活电子邮件在Django中不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试查看password reset是否可以在我的development environment中工作.activation email发送到我的console.但是当我将其粘贴到browser上时,出现以下错误:

I am trying to see if password reset works in my development environment.The activation email is sent out to my console. but when I paste it on the browser, I get the following error:

Request Method: GET
Request URL:    http://127.0.0.1:8000/accounts/password/reset/confirm/MQ/3q5-7f3106e0a0cfc67d8bee/
Django Version: 1.6.2
Exception Type: NoReverseMatch
Exception Value:
Reverse for 'password_reset_complete' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []

我关注了这篇文章,但没有帮助.这是我的urls.py;

I followed this post, but did not help.Here is my urls.py;

from django.conf.urls import include
from django.conf.urls import patterns
from django.conf.urls import url

from django.contrib.auth import views as auth_views
from django.core.urlresolvers import reverse_lazy

urlpatterns = patterns('',
                           url(r'^login/$',
                               auth_views.login,
                               {'template_name': 'registration/login.html'},
                               name='auth_login'),
                           url(r'^logout/$',
                               auth_views.logout,
                               {'template_name': 'registration/logout.html'},
                               name='auth_logout'),
                           url(r'^password/change/$',
                               auth_views.password_change,
                               {'post_change_redirect': reverse_lazy('auth_password_change_done')},
                               name='auth_password_change'),
                           url(r'^password/change/done/$',
                               auth_views.password_change_done,
                               name='auth_password_change_done'),
                           url(r'^password/reset/$',
                               auth_views.password_reset,
                               {'post_reset_redirect': reverse_lazy('auth_password_reset_done')},
                               name='auth_password_reset'),
                           url(r'^password/reset/confirm/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>.+)/$',
                               auth_views.password_reset_confirm,
                               name='auth_password_reset_confirm'),
                           url(r'^password/reset/complete/$',
                               auth_views.password_reset_complete,
                               {'post_reset_redirect': reverse_lazy('auth_password_reset_complete')},
                               name='auth_password_reset_complete'),
                           url(r'^password/reset/done/$',
                               auth_views.password_reset_done,
                               name='auth_password_reset_done'),
    )

如何解决此问题?我正在使用django 1.6谢谢

How to fix this? I am using django 1.6Thanks

推荐答案

模板中的某处可能是{% url 'password_reset_complete' %}.更改为

There is probably {% url 'password_reset_complete' %} somewhere in your template. Change it to

{% url 'auth_password_reset_complete' %}

这篇关于No ReverseMatch:密码重置激活电子邮件在Django中不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-28 04:28