In this step by step tutorial we’ll learn how to create an email verification system in Django from Scratch.
We will not use any external libraries or frameworks for authentication, instead we will create everything ourselves; we will make our own token generator, custom generator form, Activation email and view that checks the validity of the tokens and handles the activation status of user accounts and much much more. The goal is to provide a clear and comprehensive guide.
Throughout this tutorial, we'll cover essential aspects of the implementation; we will create our own token generator, custom generator form, activation email and views that checks the validity of the tokens and handles the activation status of user accounts and much much more. My goal when making this tutorial is to make the whole process as clear and complete as possible.
You can access and download the code file from my Patreon page:
www.patreon.com/PikoCanFly
Chapters:
00:00 - What will do
00:22 - Create Directory
00:33 - Create Python .venv Environment
00:50 - Install Django
01:21 - start new django project + runserver + run migrations
Configure Email Settings:
02:25 - Create .env to keep environment variables - such as email address and password
03:07 - Install and use Python dot env (python-dotenv) to load environment variables
03:30 - Configure Django email settings for sending emails using the SMTP server
Token Generator:
5:40 - Create tokens.py
5:54 - Define Token Generator Function that inherits from PasswordResetTokenGenerator
Registration Form:
07:11 - Create forms.py
08:13 - Define Class Registration form that inherits from Django’s UserCreationForm
Views:
09:47 - Create views.py
09:58 - Define Registration View that has logic for email message including sending the verification email
16:53 - Define Index view
17:38 - Define Activate View + logic to decode token and activate users
URLS
21:55 - define URL patterns
Templates:
23:40 - Create templates dir + add path in settings.py
24:45 - create base-template file + Add HTML boilerplate
28:31 - Create Register template followed by Login template
30:15 - Activation Email Template
31:49 - Redirect to index upon Login
32:16 - Add Path to Static Directory in settings.py
34:09 - Add CSS styling
34:58 - Style message according to tag
-----
If you're considering hosting your app on DigitalOcean, it’d be awesome if you used my referral link! You'll get $200 in free credits, and I'll get $25.
Here is the link: m.do.co/c/58e570dc13ea
#Python #Django #tutorial #authentication #email #verification
コメント