'password_reset_confirm' not found 继续获取 Reverse。 'password_reset_confirm' 不是有效的视图函数或模式名称。错误
keep getting Reverse for 'password_reset_confirm' not found. 'password_reset_confirm' is not a valid view function or pattern name. error
我想在我的网页上实现密码重置功能,但出现 NoReverseMatch at /accounts/password_reset/ Reverse for 'password_reset_confirm' not found. 'password_reset_confirm' is not a valid view function or pattern name.
错误。请帮我解决这个错误
url.py代码:
app_name="accounts"
urlpatterns=[
path('password_reset/', auth_views.PasswordResetView.as_view(template_name="password_reset.html",success_url=reverse_lazy('accounts:password_reset_done')), name='password_reset'),
path('password_reset_done/', auth_views.PasswordResetDoneView.as_view(), name='password_reset_done'),
path('reset/<uidb64>/<token>/', auth_views.PasswordResetConfirmView.as_view(template_name="password_reset_confirm.html",success_url=reverse_lazy('accounts:password_reset_complete')),
name="password_reset_confirm"),
path('reset_password_complete/',
auth_views.PasswordResetCompleteView.as_view(template_name="password_reset_done.html"), name="password_reset_complete"),
]
passwrd_reset.html
{% extends 'base.html' %}
{% block title %}Password Reset Page{% endblock %}
{% load crispy_forms_tags %}
{% block body %}
<div class="container">
<div class="row mt-5 pt-3">
<div class="col-md-8 offset-md-2">
<div class="card my-3 shadow">
<div class="card-body">
<h4>Password Reset Page</h4>
<hr>
<div class="alert alert-info">
Enter email and a mail will be sent with instructions to reset password
</div>
<form method="POST">
{% csrf_token %}
{{ form|crispy }}
<input class="btn btn-primary btn-block" type="submit" value="Reset Password">
</form>
<hr>
</div>
</div>
</div>
</div>
{% 端块体%}
有关我的应用程序的其他信息
我有两个应用程序,一个是仪表板,另一个是帐户我想在我的帐户应用程序中实现它
检查您的 html 文件名。有 password_reset_confirm.html 文件吗?
在您的 core
应用中(您有 settings.py
)。转到您的 urls.py
文件并粘贴:
path('', include('django.contrib.auth.urls'))
请注意,您必须从 django.urls
导入 include
。
我想在我的网页上实现密码重置功能,但出现 NoReverseMatch at /accounts/password_reset/ Reverse for 'password_reset_confirm' not found. 'password_reset_confirm' is not a valid view function or pattern name.
错误。请帮我解决这个错误
url.py代码:
app_name="accounts"
urlpatterns=[
path('password_reset/', auth_views.PasswordResetView.as_view(template_name="password_reset.html",success_url=reverse_lazy('accounts:password_reset_done')), name='password_reset'),
path('password_reset_done/', auth_views.PasswordResetDoneView.as_view(), name='password_reset_done'),
path('reset/<uidb64>/<token>/', auth_views.PasswordResetConfirmView.as_view(template_name="password_reset_confirm.html",success_url=reverse_lazy('accounts:password_reset_complete')),
name="password_reset_confirm"),
path('reset_password_complete/',
auth_views.PasswordResetCompleteView.as_view(template_name="password_reset_done.html"), name="password_reset_complete"),
]
passwrd_reset.html
{% extends 'base.html' %}
{% block title %}Password Reset Page{% endblock %}
{% load crispy_forms_tags %}
{% block body %}
<div class="container">
<div class="row mt-5 pt-3">
<div class="col-md-8 offset-md-2">
<div class="card my-3 shadow">
<div class="card-body">
<h4>Password Reset Page</h4>
<hr>
<div class="alert alert-info">
Enter email and a mail will be sent with instructions to reset password
</div>
<form method="POST">
{% csrf_token %}
{{ form|crispy }}
<input class="btn btn-primary btn-block" type="submit" value="Reset Password">
</form>
<hr>
</div>
</div>
</div>
</div>
{% 端块体%}
有关我的应用程序的其他信息 我有两个应用程序,一个是仪表板,另一个是帐户我想在我的帐户应用程序中实现它
检查您的 html 文件名。有 password_reset_confirm.html 文件吗?
在您的 core
应用中(您有 settings.py
)。转到您的 urls.py
文件并粘贴:
path('', include('django.contrib.auth.urls'))
请注意,您必须从 django.urls
导入 include
。