[英]NoReverseMatch: Reverse for ''django.contrib.auth.views.password_reset_confirm''
[英]path is deprecated (django.contrib.auth.views.password_reset_confirm)
我正在django項目上重置密碼,當發送電子郵件地址時我得到
path is deprecated (django.contrib.auth.views.password_reset_confirm)
在命令提示符下。
這是我的url.py
from django.conf.urls import patterns, include, url
from django.contrib import admin
from doreenselly import views
from django.conf import settings
from django.conf.urls.static import static
from django.contrib.auth.views import password_reset, password_reset_done, password_reset_confirm, password_reset_complete
from django.views.generic import TemplateView
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^$', 'selly.views.index', name="index"),
url(r'^selly/', include('selly.urls')),
url(r'^delete_item/(?P<item_id>[-\w]+)/$', views.delete_item, name='delete_item'),
url(r'^admin_delete_item/(?P<item_id>[-\w]+)/$', views.admin_delete_item, name='admin_delete_item'),
# Password reset urls
url(r'^reset/form/$', TemplateView.as_view(template_name = 'registration/password_reset_email.html')),
url(r'^resetpassword/passwordsent/$', password_reset_done, name="password_reset_done"),
url(r'^reset/password/$', password_reset, name="password_reset"),
url(r'^reset/(?P<uidb64>[0-9A-Za-z]+)-(?P<token>.+)/$', password_reset_confirm, name="password_reset_confirm"),
url(r'^reset/done/$', password_reset_complete, name="password_reset_complete"),
]
您的網址看起來不錯,所以我想問題出在您的模板中。
尋找
{% url 'django.contrib.auth.views.password_reset_confirm' uidb64=uid token=token %}
在您的registration/password_reset_email.html
模板中,並將其替換為
{% url 'password_reset_confirm' uidb64=uid token=token %}
如果那不能解決問題,那么您需要找出警告的來源。 您可以使用-W
標志運行dev服務器,以將警告變為異常 。
python -W error manage.py runserver
當您發送密碼重置電子郵件時,您將得到一個回溯,它將向您顯示問題出在哪里。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.