#100DaysOfWeb in Python Transcripts
Chapter: Days 53-56: Django part 2 - registration and login
Lecture: Setting required django-registration templates

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Last video we ended with the template does not exist exception and to make this simpler I'm going to provide you with a set of templates
0:10 that you can just put into place. Here in the general registration documentation quick start guide it's actually mentioned that
0:22 you will need to create several templates and possibly additional templates required by views in django.contrib.auth.
0:30 So as we know by now Django comes with its own authentication system. So if we're going to use the log in and log out
0:38 we're actually using the contrib.auth. And the registration plugin you can see has a shell round it to handle the sign up of users.
0:47 So there are two systems at play. And before both were using the registration directory and now the latter has changed to use django_registration.
0:57 And here it outlines all the templates you will need and I was a bit surprised that no defaults were provided.
1:06 You kind of have to build those from scratch and that's why I'm providing a zip file with all the right stuff in place.
1:14 Two things about that, I kept it pretty generic so I'm not mentioning quotes. So you can use it for your own app.
1:20 And secondly I did endorse write stylings. So there's some MUI classes in there. So styles nice but the MUI CSS framework
1:29 that we're using throughout this app. So let's get the zip file into place. So here at your hundred days of web with Python course repo...
1:40 in days in the 053 directory there's a zip file. And you have to copy that into the templates folder into the mysite templates folder.
1:57 So I'm going to take note of this path and back to my app I go into my main app, into templates. And we should have the base.html file
2:11 from the first Django module. And I'm going to copy the zip file into this directory, so again I'm in mysite/templates, going to unzip it
2:27 and you see that it nicely puts everything into place. I even have a README, with the instructions. So we did this, we unzipped it, and now we can
2:40 remove the zip and this README file. And here is a tree and this tree should match what I'm getting. So let's remove the README
2:52 let's remove the zip file. And let's do a tree, and yes I got two directories and 18 files. It's important to have the base.html
3:02 at the top level templates directory. And then have two directories Django registration with all the required
3:11 registration templates. And these should match the ones listed here. Actually, I was struggling here because some of these templates were renamed
3:23 going from 2.0 to 3.0. So these are templates that work with Django registration 3.0 and the registration directory is for the actions related to
3:36 Django's native authentication system. So log in log out and we will see password reset in action later. So with this in place
3:46 let's see if it all still works. And see if I can now navigate to these templates And that's awesome I can. On this log in screen, there's also
4:03 a reset password functionality. And of course the register action which nicely routes to accounts/register
4:13 and not getting template does not exist exceptions any more means that all the correct templates are in place. In order to demo this
4:20 I need email working because signing up will trigger an email to the email address that's filled out here. So now it's time to
4:28 set up an account with SendGrid, which is an email delivery service. And then we put in the right configuration in Django
4:36 and then we got email out of the box. So let's do that next.


Talk Python's Mastodon Michael Kennedy's Mastodon