iMerica / dj-rest-auth

Authentication for Django Rest Framework
https://dj-rest-auth.readthedocs.io/en/latest/index.html
MIT License
1.64k stars 306 forks source link

NoReverseMatch: Reverse for 'account_confirm_email' not found. #441

Open dubeyteja opened 1 year ago

dubeyteja commented 1 year ago

django.urls.exceptions.NoReverseMatch: Reverse for 'account_confirm_email' not found. 'account_confirm_email' is not a valid view function or pattern name.

I have created my own url files for dj-rest-auth using this tutorial https://jkaylight.medium.com/django-rest-framework-authentication-with-dj-rest-auth-4d5e606cde4d.

I did the same but its not working. I tried to clone his repo. But everything works fine on his repo. ` from django.urls import path, re_path from dj_rest_auth.registration.views import RegisterView, VerifyEmailView, ConfirmEmailView from dj_rest_auth.views import LoginView, LogoutView

from user import views

app_name = 'user'

urlpatterns = [ path('account-confirm-email//', ConfirmEmailView.as_view()), path('register/', RegisterView.as_view()), path('login/', LoginView.as_view()), path('logout/', LogoutView.as_view()),

path('verify-email/',
     VerifyEmailView.as_view(), name='rest_verify_email'),
path('account-confirm-email/',
     VerifyEmailView.as_view(), name='account_email_verification_sent'),
re_path(r'^account-confirm-email/(?P<key>[-:\w]+)/$',
        VerifyEmailView.as_view(), name='account_confirm_email'),
path('listusers/', views.ListUsers.as_view(), name='list-users'),

] `

TanimSk commented 1 year ago

Have a look at my configuration, hopefully, that will help -

from django.urls import path, include, re_path
from dj_rest_auth.registration.views import VerifyEmailView

urlpatterns = [
    path('dj-rest-auth/', include('dj_rest_auth.urls')),
    re_path(r'^dj-rest-auth/registration/account-confirm-email/(?P<key>[-:\w]+)/$', VerifyEmailView.as_view(),
            name='account_email_verification_sent'),

    path('dj-rest-auth/registration/', include('dj_rest_auth.registration.urls')),
]