Django Allauth (3) – Email Verification via Console
This lesson will explain how to set up email verification using a console (terminal) in the development environment.
1. Edit settings.py
The console-based email verification setting is easy to implement. You just need to edit the two lines of code in settings.py.
- Change
ACCOUNT_EMAIL_VERIFICATION
from "none" to "mandatory
" - Add
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
in the end of settings.py
The second setting enables Django to display email contents in the console.
ACCOUNT_AUTHENTICATION_METHOD = "email"
ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_EMAIL_VERIFICATION = "mandatory"
:
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
2. Check the results
To check the results, try to sign up again. You can use a dummy email, as no email will be actually sent.
Subscribe now for
uninterrupted access.