URL重置密码,Django 1.6.5

时间:2014-08-15 07:44:28

标签: python django django-urls

我使用django.contrib.auth.views.password_reset重置用户密码

 (r'^reset/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>.+)/$', 'django.contrib.auth.views.password_reset_confirm'),

我收到了这个错误:

NoReverseMatch at /reset/Nw/3u5-5654a2cadfa432b86577/
Reverse for 'password_reset_complete' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []

当我把参数名称=&#39; password_reset_confirm&#39;在网址中:

(r'^reset/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>.+)/$',
    'django.contrib.auth.views.password_reset_confirm',
    name='password_reset_confirm'),

我收到此错误:

  

发生服务器错误。请联系管理员。

(Eclipse显示有一个错误:语法错误检测元组) 有人有经验吗?

1 个答案:

答案 0 :(得分:0)

这里有一些问题:

第一个错误: django应用程序可能要求您将password_reset_complete添加到您的网址配置

请参阅此答案:https://stackoverflow.com/a/15203487/1714030

第二个错误:

您可能需要添加“url”功能:     (尝试在元组中声明name = ...会生成错误)

url(r'^reset/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>.+)/$',
'django.contrib.auth.views.password_reset_confirm',
name='password_reset_confirm')

希望这有帮助