Django:密码重置时没有反向匹配

Django:密码重置时没有反向匹配,django,Django,我正在使用自定义模板在Django中开发密码重置功能。 但当我输入mail:id并单击重置密码时,我面临“无反向匹配错误”。请有人帮助我,我理解这是一个老问题,我已按照其他答案尝试解决,但无法找到解决方案。请找到下面的代码并帮我解决此问题 url.py: from django.conf.urls import url,include from django.contrib import admin from django.contrib.auth.views import password_r

我正在使用自定义模板在Django中开发密码重置功能。 但当我输入mail:id并单击重置密码时,我面临“无反向匹配错误”。请有人帮助我,我理解这是一个老问题,我已按照其他答案尝试解决,但无法找到解决方案。请找到下面的代码并帮我解决此问题

url.py

from django.conf.urls import url,include
from django.contrib import admin
from django.contrib.auth.views import password_reset,password_reset_done,password_reset_confirm,password_reset_complete
from surveysite.views import home,about,login,loggedin,loggedout

urlpatterns = [
    url(r'^$', home, name='home'),
    url(r'^about/$',about, name='about'),
    url(r'^accounts/', include('registration.backends.default.urls')),
    url(r'^accounts/login/$', login, name='login'),
    url(r'^accounts/loggedin/$',loggedin, name='loggedin'),
    url(r'^accounts/logout/$', loggedout, name='logout'),
    url(r'^accounts/password_reset/$', password_reset, 
        {'post_reset_redirect' : '/accounts/password_reset/mailed/'},
        name="password_reset"),
    url(r'^accounts/password_reset/mailed/$',password_reset_done),
    url(r'^accounts/password_reset/(?P<uidb36>[0-9A-Za-z]{1,13})-(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$',password_reset_confirm, 
        {'post_reset_redirect' : '/accounts/password_reset/complete/'},name="password_reset_confirm"),
    url(r'^accounts/password_reset/complete/$',password_reset_complete),
    url(r'^admin/', admin.site.urls),
]
错误堆栈跟踪

NoReverseMatch at /accounts/password_reset/

Reverse for 'django.contrib.auth.views.password_reset_confirm' with arguments '()' and keyword arguments '{u'uidb36': 'MQ', u'token': u'4jz-530973903a3b600e2a97'}' not found. 0 pattern(s) tried: []

Request Method:     POST
Request URL:    http://localhost:8000/accounts/password_reset/
Django Version:     1.10.5
Exception Type:     NoReverseMatch
Exception Value:    

Reverse for 'django.contrib.auth.views.password_reset_confirm' with arguments '()' and keyword arguments '{u'uidb36': 'MQ', u'token': u'4jz-530973903a3b600e2a97'}' not found. 0 pattern(s) tried: []

Exception Location:     C:\Python27\lib\site-packages\django\urls\resolvers.py in _reverse_with_prefix, line 392
Python Executable:  C:\Python27\python.exe
Python Version:     2.7.13
Python Path:    

['G:\\Manoj\\Software Engineering-Yui Man lee\\Django_Project\\surveysite',
 'C:\\Python27',
 'C:\\Python27\\Tools\\Scripts',
 'G:\\Manoj\\Software Engineering-Yui Man lee\\Django_Project\\surveysite',
 'C:\\WINDOWS\\SYSTEM32\\python27.zip',
 'C:\\Python27\\DLLs',
 'C:\\Python27\\lib',
 'C:\\Python27\\lib\\plat-win',
 'C:\\Python27\\lib\\lib-tk',
 'C:\\Python27\\lib\\site-packages',
 'C:\\Python27\\lib\\site-packages\\PIL']

In template G:\Manoj\Software Engineering-Yui Man lee\Django_Project\surveysite\templates\registration\password_reset_email.html, error at line 6
我尝试了以下链接的解决方案,但找不到解决方案


下面是==>自定义模板中的教程。

您只需引用要匹配的url模式的名称,而不是引用视图

{% url 'password_reset_confirm' uidb36=uid token=token %}

您不需要引用视图,只需要引用您试图匹配的url模式的名称

{% url 'password_reset_confirm' uidb36=uid token=token %}

谢谢你的回答,它正在使用Chrome浏览器,但昨天我正在使用Firefox,它不工作,可能是因为我的浏览器设置。谢谢你的回答,它正在使用Chrome浏览器,但昨天我正在使用Firefox,它不工作,可能是因为我的浏览器设置。