
- Python
- Intermediate
About this Course
It's time to dig in and build something big. In this course, we're going to take the tools we've learned, Flask, Peewee, and Python itself, and build a small social network. We'll have user registration, user authentication, strongly hashed passwords, form validation, and more.
What you'll learn
- User registration and authentication
- Password hashing
- Form validation
- Joins
Making Strong Users
We won't get far in our social application with out users. Let's make sure their passwords are stored correctly and strongly, too.
10 steps-
Our Project
1:38
-
Flask and Peewee Review
6 questions
-
The User Model
4:57
-
Create a User model
3 objectives
-
The UserMixin From Flask-Login
5:50
-
Add UserMixin
2 objectives
-
Cryptographic Hashing with Flask-Bcrypt
6:50
-
Bcryptkeeper
3 objectives
-
Class Method
4:07
-
What's a method like you doing in a class like this?
2 objectives
Takin' Names
Users need a way to sign up and sign in to our site. We'll need to validate their information, create our model instances, and store their session information. Luckily, we have a few handy libraries to do a lot of that for us!
12 steps-
Before and After Requests
4:27
-
To the ends of the request
3 objectives
-
LoginManager
4:38
-
Set up LoginManager
4 objectives
-
Flask-WTF Forms
9:39
-
Form with Validators
4 objectives
-
Registration View
6:33
-
Macros
4:19
-
Login View
6:17
-
Form View
3 objectives
-
Logout View
3:24
-
Controlling sessions
2 objectives
Broadcasting
Our app needs messages posted by the users. Let's give them a model, a form, and the views necessary so they can tell the world what they're up to.
10 stepsHow to Win Friends
The final ingredient in any social site is the ability to follow people. We'll need to add a new model, a couple of views, and tweak a template or two. We'll also want to change a query or two to get the full social experience.
10 steps-
Relationship Model
5:36
-
Related Users
4 objectives
-
Follow and Unfollow Buttons
8:06
-
Follow/Unfollow views
2 objectives
-
Show Follower Posts
4:21
-
Lunch Count
1 objective
-
Handling 404s
5:40
-
Uh-Oh 404!
3 objectives
-
Suggestions
0:43
-
Review: Build a Social Network with Flask
6 questions
-
Extra Credit
Some other ideas for extending this app are:
- Add a form and view to allow users to change their username, email address, and password.
- Allow users to repost or respond to updates in a linked method. You'd probably want to start by adding a foreign key to
Post
that pointed to anotherPost
.
Teacher
-
Kenneth Love
Besides teaching Python, Kenneth Love is a husband and father. He created a few popular Python libraries, worked at most levels of the web stack, and was the Creative Director of a newspaper. He likes board games, whiskey, activism, and dry humor.