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

When encountering the error message “reverse for ‘password_reset_confirm’ not found. ‘password_reset_confirm’ is not a valid view function or pattern name.”, it means that the URL or view function associated with the name ‘password_reset_confirm’ could not be found or does not exist. This error commonly occurs in web development when using Django’s URL pattern matching and reversing system.

Here’s an example to explain the issue further:

    
      # urls.py

      from django.urls import path
      from . import views

      urlpatterns = [
          path('reset///', views.password_reset_confirm, name='password_reset_confirm'),
      ]
    
  
    
      # views.py

      from django.shortcuts import render

      def password_reset_confirm(request, uidb64, token):
          # Your password reset confirm logic here
          pass
    
  

In the above example, we have defined a URL pattern in the urls.py file with the name ‘password_reset_confirm’ and associated it with the view function password_reset_confirm in the views.py file.

If you encounter the mentioned error, double-check the following:

1. Make sure the URL pattern with the name ‘password_reset_confirm’ exists in your urls.py file.
2. Verify that the associated view function password_reset_confirm is defined in your views.py file or imported correctly.

Read more

Leave a comment