首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何解决此错误“'password_reset‘不是rest api django中已注册的命名空间”

如何解决此错误“'password_reset‘不是rest api django中已注册的命名空间”
EN

Stack Overflow用户
提问于 2020-06-18 09:54:44
回答 1查看 180关注 0票数 3

enter image description here

代码语言:javascript
复制
hi i am implementing password-reset feature on rest_API using `django_rest_passwordreset` library.but while testing end points its giving the following error:

/api/ NoReverseMatch /password_reset/reset-password 'password_reset‘中的密码不是已注册的命名空间

代码语言:javascript
复制
please check the code below:


from django.urls import path,include
from account.api.views import SignupApiView
from account.api.views import UserCreationView
from account.api.views import ProfileView,EnableDisableUserView
from rest_framework.authtoken.views import obtain_auth_token



app_name = 'account'

urlpatterns = [
    path("signup",SignupApiView.as_view(),name="signup"),
    path("create_user",UserCreationView().as_view(),name="create_user"),
    path("profile/<int:pk>",ProfileView.as_view(),name="profile"),
    path("disable_users/<slug:slug>",EnableDisableUserView.as_view()),
    path("disable_users/<int:pk>",EnableDisableUserView.as_view(),name="disable"),
    path("login",obtain_auth_token,name="login"),
    path('password_reset/', include('django_rest_passwordreset.urls', namespace='password_reset')),#this is where i am getting the error
]
EN

Stack Overflow用户

发布于 2020-12-20 21:25:28

尝试将密码重置urls移到主urls.py文件中

代码语言:javascript
复制
#in main urls.py
...
    path('api/password_reset/', include('django_rest_passwordreset.urls', namespace='password_reset')),
...

如果您已经包含api/ url,则可以只将url password_reset/设置为不带api/,以避免冲突

票数 3
EN
查看全部 1 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/62441111

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档