Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

registration with email verification with dj-rest-auth

Hi everyone I am developing a website with django rest framework for backend and I am using dj-rest-auth for authentication. And I want to implement registration with email veification, based on documents of dj-rest-auth these are urls for registration:

urlpatterns = [
path('api-auth/', include('rest_framework.urls')),

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

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

and in settings I did these things:

INSTALLED_APPS = [
    'accounts.apps.AccountsConfig',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',

    'corsheaders',

    'rest_framework',
    'rest_framework.authtoken',
    'dj_rest_auth',

    'django.contrib.sites',
    'allauth',
    'allauth.account',
    'allauth.socialaccount',
    'dj_rest_auth.registration',
]

SITE_ID = 1
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'

ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_UNIQUE_EMAIL = True
ACCOUNT_USERNAME_REQUIRED = False
ACCOUNT_AUTHENTICATION_METHOD = 'email'
ACCOUNT_EMAIL_VERIFICATION = 'mandatory'
ACCOUNT_CONFIRM_EMAIL_ON_GET = True

LOGIN_URL = 'http://localhost:8000/accounts_api/api/v1/dj-rest-auth/login'

and I am using gmail smtp for smtp.

But after sending a user info for registration I got this error:

Reverse for 'account_confirm_email' not found. 'account_confirm_email' is not a valid view function or pattern name.

Can anyone tell me about where I am wrong?

like image 361
SAM Avatar asked Oct 26 '25 20:10

SAM


1 Answers

This was explained in the FAQ section, read the first question.

like image 98
Mahmoud Adel Avatar answered Oct 29 '25 18:10

Mahmoud Adel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!