enter image description here
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:
NoReverseMatch at /api/accounts/password_reset/reset-password 'password_reset' is not a registered namespace
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
]
Try move your password reset urls to your main urls.py file
#in main urls.py
...
path('api/password_reset/', include('django_rest_passwordreset.urls', namespace='password_reset')),
...
If you already have api/ urls included you can just make the url password_reset/ without api/ to avoid conflict
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With