error in password reset confirm django

I have the following error when performing the password reset in django

mis URLS.PY

app_name = ‘users_app’

urlpatterns = [
path(‘’, views.LoginUser.as_view(), name=‘login_user’),
path(‘logout-user’, views.Logout_View.as_view(), name=‘logout’),
path(‘create-users’, views.UserCreateView.as_view(), name=‘create_users’),
path(‘user-update//’, views.UserUpdateView.as_view(), name=‘user_update’),
path(‘change-password’, views.UserPasswordChange.as_view(), name=‘change_password’),
path(‘password-user’, views.UserUpdatePassword.as_view(), name=‘password_user’),
path(‘turnos-view’, views.TurnosView.as_view(), name=‘turnos_view’),
path(‘list-users’, views.ListUserRegister.as_view(), name=‘list_users’),

path('reset_password', views.UserPasswordReset.as_view(template_name='users/password_reset.html'), name="reset_password"),

path('password-reset-done', views.UserPasswordResetDone.as_view(), name="password_reset_done"),

path('reset/<uidb64>/<token>/', views.UserPasswordResetConfirm.as_view(), name="password_reset_confirm"),

ERRORS

NoReverseMatch at /reset_password

Reverse for ‘password_reset_confirm’ not found. ‘password_reset_confirm’ is not a valid view function or pattern name.

Side note: When posting code, please remember to surround the code between lines of three backtick - ` characters. This means you’ll have a line of ```, then your code, then another line of ```.

You have these urls defined within an app named users_app. This defines a namespace for these url names, and so must be referenced in the url tag with that app name as a prefix → users_app:password_reset_confirm.

Note: As a general rule, you don’t want to do it this way. You may encounter other, similar problems with other templates and views. The default usage of these urls expects them to not be within an apps url namespace. I generally recommend these urls be defined outside an apps url namespace. (This doesn’t apply if you’re using your own views and templates for these functions.)

1 Like

can i share my github code ? can you help me

i just did what you told me delete users_app and i get the following error

“expected str, bytes or os.PathLike object, not NoneType”

Actually, that’s not quite what I suggested.

What I suggested is that you move those specific urls out of your application and in to your root urls.py file.

Regarding the other error, what I would suggest is that you start by posting the complete traceback of the error you are receiving - that should provide some clues as to what needs to be looked at next.