Django内置密码重置,我的网址有什么问题?

时间:2022-11-15 09:57:38

Everyone seems to point to this guide for easy plug-in password reset: http://garmoncheg.blogspot.com.au/2012/07/django-resetting-passwords-with.html

每个人似乎都指向本指南,以便轻松插入密码重置:http://garmoncheg.blogspot.com.au/2012/07/django-resetting-passwords-with.html

So from what I've read, if you want it to function then the urls are all you need are 4 urls defined:

所以从我读过的内容来看,如果你希望它能够正常运行,那么你需要的只是4个url定义的url:

urlpatterns = patterns('',
 . . . 
    url(r'^user/password/reset/$', 'django.contrib.auth.views.password_reset', {'post_reset_redirect' : '/user/password/reset/done/'}, name="password_reset"),
        (r'^user/password/reset/done/$', 'django.contrib.auth.views.password_reset_done'),
        (r'^user/password/reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$', 'django.contrib.auth.views.password_reset_confirm', {'post_reset_redirect' : '/user/password/done/'}),
        (r'^user/password/done/$', 'django.contrib.auth.views.password_reset_complete'),
 . . .
)

This does not seem to be working as I'm still getting the infamous

这似乎不起作用,因为我仍然臭名昭着

NoReverseMatch at /user/password/reset/

NoReverseMatch at / user / password / reset /

with this:

Reverse for 'password_reset_confirm' with arguments '()' and keyword arguments '{u'uidb64': 'NA', u'token': u'3ps-749165b2b39d4168f97f'}' not found. 1 pattern(s) tried: ['user/password/reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$']

Is there something depreciated already with the guide I put a link to at the top? Should I be importing anything to the urls.py file?

指南中是否有某些东西已经折旧了我将链接放在顶部?我应该将任何内容导入urls.py文件吗?

1 个解决方案

#1


4  

Your url pattern is using uidb36, but your reverse call is looking for uidb64. See the documentation for more information on this change in 1.6.

您的网址格式正在使用uidb36,但您的反向呼叫正在寻找uidb64。有关1.6中此更改的更多信息,请参阅文档。

#1


4  

Your url pattern is using uidb36, but your reverse call is looking for uidb64. See the documentation for more information on this change in 1.6.

您的网址格式正在使用uidb36,但您的反向呼叫正在寻找uidb64。有关1.6中此更改的更多信息,请参阅文档。