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