django - Django-rest-auth:找不到“password_reset_confirm”的反向。'password_reset_confirm' 不是有效的视图函数或模式名称
问题描述
我正在尝试使用 django-rest-auth 密码重置功能,但在发布请求后,/rest-auth/password/reset/
我收到标题中所述的错误(Traceback),我不明白为什么。我按照文档页面中的安装过程进行操作。我urls.py
的是:
from django.urls import include, path
urlpatterns = [
path('users/', include('users.urls')),
path('rest-auth/', include('rest_auth.urls')),
path('rest-auth/registration/', include('rest_auth.registration.urls')),
我还添加了所需的应用程序settings.py
解决方案
我通过添加解决了
from django.urls import include, path, re_path
from rest_auth.views import PasswordResetConfirmView
re_path(r'^rest-auth/password/reset/confirm/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$', PasswordResetConfirmView.as_view(),
name='password_reset_confirm'),
到 .url 中的urls.py
urlpatterns 这样,您将在邮件中获得一个重置链接,例如:../password/reset/confirm/uid/token
。为了完成该过程,您必须../password/reset/confirm/
使用此正文发送 POST 请求:
{
"new_password1": "",
"new_password2": "",
"uid": "",
"token": ""
}
推荐阅读
- android - 如何使用 std::ifstream 在 Android 上使用 C++ 获取文件大小?
- amazon-web-services - 在 AWS Step 函数中获取状态机的所有失败执行并动态执行。(在Java中)
- r - 如何转置我的数据,使其在 R 中每组只有一行?
- ubuntu - Snort 3.0 错误:找不到请求的 DAQ 模块:pcap
- javascript - 仅在画布图像上绘制绿色像素
- selenium - 类的并行执行不起作用 TestNG.xml 文件
- c++ - 如何使用 C++ 读取 Hololens 上的文件
- python - Pandas:从旧数据框中的字符串中提取的数据创建新数据框
- css - 有没有办法使用 css 制作一个尺寸的图像?
- istio - istio-ingressgateway LoadBalancer 在 AWS EKS 中显示“待处理”