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