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

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Alright, let's first install Django registration. But first I'm going to pull down the code
0:07 from the last lesson, Django one, in case you don't have it. So I can clone the course repo. CD into it. Day 53.
0:30 But it's actually 45. And I can copy minus R to the copy directory. Demo and I'm going to store that in code django2.
0:48 CD into that last directory so I'm in home code Django two. Of course I lost my virtual environment so I'm going to set up one. I made this.
1:08 I'm going to edit the requirements to add Django registration. And then I'm going to pip install the requirements.
1:26 Let's see if Django runs. And of course I have to also add my secret key because I just made my new virtual environment
1:40 so it doesn't have it by default. You probably want to have longer on the production and I'm on debug equals true.
2:00 Then I need to deactivate and activate my virtual environment again to have those variables spring into life. Right, let's see if Django still runs.
2:20 And of course I need to apply the migrations because we use this SQLite database, which is file-based
2:27 which I did not pull in because it was git ignored. So let's migrate and run the server again. And now it should all work. Excellent. Great.
3:04 With requirements updated, when I did a pip install pip install django_registration. And one final step in this video is to add a setting.
3:20 So as you remember from last time Django's configuration is in the main app which in this case is my site slash settings.py. Go to the end.
3:32 And I'm going to add ACCOUNT_ACTIVATION_DAYS = 7 That's the Django registration setting of the amount of days that an activation link will be valid.
3:50 I'm also going to put a logout redirect URL. I'm going to define that as quote lift and quote lift is in my quotes app
4:09 and that is just a default view of the listing of the quotes. And I'm also going to specify that as login redirect URL and we will see that later.
4:25 An importantly, we also want to add Django registrations to our installed apps. I'm going put a before quotes
4:38 and actually it comes now with an extra migration so I have to run this again. And here we see that there's a Django registration migration
4:48 being run and next we're going to look at the URLs.py to add new routes to it to support registration.

Talk Python's Mastodon Michael Kennedy's Mastodon