# Password change and reset views, url NoReverseMatch

**URL:** <https://forum.djangoproject.com/t/password-change-and-reset-views-url-noreversematch/32808>\
**Category:** Mystery Errors\
**Created:** [July 8, 2024, 8:27pm UTC](https://forum.djangoproject.com/t/password-change-and-reset-views-url-noreversematch/32808 "2024-07-08T20:27:41Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![harkerbyte](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/harkerbyte/32/17958_2.png) [@harkerbyte](https://forum.djangoproject.com/u/harkerbyte)\
**Post date:** [July 8, 2024, 8:27pm UTC](https://forum.djangoproject.com/t/password-change-and-reset-views-url-noreversematch/32808/1 "2024-07-08T20:27:41Z")

</div>

i’ve configured a seperate app to manage logins,logout, password change and reset..However after changing password at :  
name= `password_change` after password has been change it supposed to return page urlpattern name = `password_change_done` but it keeps returning an error saying :

# NoReverseMatch at /accounts/password-change

Reverse for ‘password\_change\_done’ not found. ‘password\_change\_done’ is not a valid view function or pattern name.

```auto
app_name = 'accounts'

    path('password-change',views.PasswordChange.as_view(),name="password_change"),
    path('password-change/done',views.PasswordChangeDone.as_view(),name="password_change_done"),
    path('password-reset',views.PasswordReset.as_view(), name="password_reset"),
    path('password-reset/done',views.PasswordResetDone.as_view(), name="password_reset_done"),
    path('password-reset/confirm',views.PasswordResetConfirm.as_view(), name="password_reset_confirm"),
    path('password-reset/complete',views.PasswordResetComplete.as_view(), name="password_reset_complete"),

```

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [July 8, 2024, 8:40pm UTC](https://forum.djangoproject.com/t/password-change-and-reset-views-url-noreversematch/32808/2 "2024-07-08T20:40:43Z")

</div>

> [@harkerbyte](#):
>
> i’ve configured a seperate app to manage logins,logout, password change and reset

By using the `app_name` attribute, you have created a namespace for those urls, which needs to be specified when referencing those urls by name.

See the docs and examples at [URL dispatcher | Django documentation | Django](https://docs.djangoproject.com/en/5.0/topics/http/urls/#url-namespaces)

---

<div class="post-metadata">

**Author:** ![harkerbyte](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/harkerbyte/32/17958_2.png) [@harkerbyte](https://forum.djangoproject.com/u/harkerbyte)\
**Post date:** [July 9, 2024, 5:06pm UTC](https://forum.djangoproject.com/t/password-change-and-reset-views-url-noreversematch/32808/3 "2024-07-09T17:06:30Z")

</div>

Fixed the issue my registering no `namespace` nor `app_name`… However the page `password_reset_complete` keeps returning this error : suggesting the namepace = `accounts` isn’t registered but i don’t have it anywhere registered in the app.

```auto

Internal Server Error: /accounts/password-reset/complete
Traceback (most recent call last):
  File "c:\Users\USER\Desktop\DB\prohub\.venv\lib\site-packages\django\urls\base.py", line 71, in reverse
    extra, resolver = resolver.namespace_dict[ns]
KeyError: 'accounts'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\Users\USER\Desktop\DB\prohub\.venv\lib\site-packages\django\core\handlers\exception.py", line 55, in inner
    response = get_response(request)
  File "c:\Users\USER\Desktop\DB\prohub\.venv\lib\site-packages\django\core\handlers\base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "c:\Users\USER\Desktop\DB\prohub\.venv\lib\site-packages\django\views\generic\base.py", line 104, in view
    return self.dispatch(request, *args, **kwargs)
  File "c:\Users\USER\Desktop\DB\prohub\.venv\lib\site-packages\django\views\generic\base.py", line 143, in dispatch
    return handler(request, *args, **kwargs)
  File "c:\Users\USER\Desktop\DB\prohub\.venv\lib\site-packages\django\views\generic\base.py", line 226, in get
    context = self.get_context_data(**kwargs)
  File "c:\Users\USER\Desktop\DB\prohub\.venv\lib\site-packages\django\contrib\auth\views.py", line 344, in get_context_data
    context["login_url"] = resolve_url(settings.LOGIN_URL)
  File "c:\Users\USER\Desktop\DB\prohub\.venv\lib\site-packages\django\shortcuts.py", line 180, in resolve_url
    return reverse(to, args=args, kwargs=kwargs)
  File "c:\Users\USER\Desktop\DB\prohub\.venv\lib\site-packages\django\urls\base.py", line 82, in reverse
    raise NoReverseMatch("%s is not a registered namespace" % key)
django.urls.exceptions.NoReverseMatch: 'accounts' is not a registered namespace
[09/Jul/2024 18:00:06] "GET /accounts/password-reset/complete HTTP/1.1" 500 96573

```

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [July 9, 2024, 5:16pm UTC](https://forum.djangoproject.com/t/password-change-and-reset-views-url-noreversematch/32808/4 "2024-07-09T17:16:00Z")

</div>

Are you using a system-provided template or a template that you have created for the view being called by the `/accounts/password-reset/complete` url?

Please post your `PasswordResetComplete` view and the template it is rendering.

---

<div class="post-metadata">

**Author:** ![harkerbyte](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/harkerbyte/32/17958_2.png) [@harkerbyte](https://forum.djangoproject.com/u/harkerbyte)\
**Post date:** [July 10, 2024, 6:09pm UTC](https://forum.djangoproject.com/t/password-change-and-reset-views-url-noreversematch/32808/6 "2024-07-10T18:09:02Z")

</div>

views.py :

```auto
import django.contrib.auth.views as auth_views

class PasswordResetComplete(auth_views.PasswordResetCompleteView):
    template_name = 'registration/password-reset/password-reset-complete.html'

```

template :

```auto
<head>
<title>Password reset complete</title>
</head>
<body>
    <h3>Password set</h3>
    <p>Your new password has been set <a href="{%url 'user_login' %}">login</a></p>
</body>

```

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [July 10, 2024, 7:59pm UTC](https://forum.djangoproject.com/t/password-change-and-reset-views-url-noreversematch/32808/7 "2024-07-10T19:59:42Z")

</div>

What is your `LOGIN_URL` setting?

---

<div class="post-metadata">

**Author:** ![harkerbyte](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/harkerbyte/32/17958_2.png) [@harkerbyte](https://forum.djangoproject.com/u/harkerbyte)\
**Post date:** [July 10, 2024, 11:32pm UTC](https://forum.djangoproject.com/t/password-change-and-reset-views-url-noreversematch/32808/8 "2024-07-10T23:32:03Z")

</div>

Forgotten i had the namespace `accounts` registered to the `LOGIN_URL` and `LOGOUT_URL` pattern name.

The issue has been rectified now…Thanks alot Man 🙂
