Skip to main content
CourseFlix

Building data-driven web apps with Flask and SQLAlchemy

9h 38m 43s
English
Paid

Embrace the power of Python to craft clean and powerful web applications with this comprehensive course. Once you've mastered basic programming concepts, we will guide you through the process of building data-driven, modern web applications in Python using the popular Flask web framework. If you're aiming to achieve full-stack web development skills, this course delivers essential knowledge through a concise and practical approach, minimizing confusion from the multitude of involved technologies.

Course Resources and Repository

Access the source code and course materials on GitHub:

github.com/talkpython/data-driven-web-apps-with-flask

Our carefully designed course strikes a balance by being just real enough to provide you with practical insights without overwhelming extras. Throughout the course, we will build a replica of a popular web application, specifically Python's own packaging index at pypi.org.

Key Learning Outcomes

Follow along with the development of our PyPI replica, and you will:

  • Explore different major Python web frameworks
  • Create a Flask-based website from scratch using the CLI and PyCharm
  • Work with dynamic HTML templates
  • Utilize routing to map URLs to view methods
  • Leverage advanced routing to build a custom CMS swiftly
  • Implement Bootstrap to craft visually appealing sites
  • Use SQLAlchemy to map data with Python classes
  • Utilize Alembic for evolving databases in response to model changes
  • Capture user input with HTML forms
  • Incorporate client and server-side validation
  • Tackle the unique challenges of testing web apps, including databases and frameworks
  • Deploy your web application on a fresh Linux machine, either virtual or cloud-based
  • Apply our design patterns to convert to other data models, such as MongoDB

Who Should Enroll?

This course is tailored for developers interested in crafting Python-based web applications using Flask. Additionally, the web development skills you acquire here are valuable across different frameworks.

We assume learners come with a foundational understanding of Python, HTML, and CSS, although the course clarifies advanced concepts in these areas as they arise.

About the Author: Talkpython

Talkpython thumbnail
Talk Python to Me is a weekly podcast hosted by Michael Kennedy. The show covers a wide array of Python topics as well as many related topics (e.g. MongoDB, AngularJS, DevOps).

Watch Online 186 lessons

This is a demo lesson (10:00 remaining)

You can watch up to 10 minutes for free. Subscribe to unlock all 186 lessons in this course and access 10,000+ hours of premium content across all courses.

View Pricing
0:00
/
#1: Introducing the course
All Course Lessons (186)
#Lesson TitleDurationAccess
1
Introducing the course Demo
00:44
2
The incredible power of web
01:36
3
What is fullstack development?
03:17
4
Student expectations and pre-reqs
01:34
5
The technologies we will learn
02:28
6
What can you build with Python?
05:18
7
Course topics
06:05
8
Meet your instructor
00:52
9
What app will we build for this course?
02:06
10
Video player: A quick feature tour
02:05
11
Do you have Python 3? How do you get it?
02:40
12
Our code editor
00:59
13
Git the source code
00:36
14
Following along
01:26
15
What are microframeworks?
02:39
16
Building blocks of Flask
03:32
17
Building block: Views
03:01
18
Building block: Routes and URLs
01:16
19
Building block: Models
01:49
20
Building block: Dynamic HTML Templates
02:29
21
Get the back story
00:59
22
Introduction to creating a Flask website
02:58
23
Demo: CLI starter site
05:56
24
Concepts: CLI starter site
03:00
25
Demo: Creating the starter project PyCharm
03:47
26
Concept: Creating the starter project PyCharm
01:26
27
Project structure
03:10
28
Template chapter introduction
01:24
29
Jinja2 template example
02:31
30
Create the PyPI site
03:42
31
Our first jinja template
08:11
32
Concept: Jinja2 templates
01:43
33
Layout: Motivation
03:20
34
Jinja2 autocomplete in PyCharm
01:13
35
Adding a simple nav element
05:21
36
Creating a common layout page
05:08
37
Better organization for your template files
02:02
38
Concepts: Common layout
02:29
39
Project structure with shared layout
01:35
40
Demo: @response a better render_template
03:38
41
Concept: @response a better render_template
02:03
42
Routing visualized
03:52
43
Demo: Routing, loading the project
01:23
44
Refactoring view methods with Flask blueprints
09:13
45
Concept: Refactoring view methods with Flask blueprints
01:21
46
Adding a constrained route
03:42
47
The account management routes
02:59
48
Concept: Create route from url
01:29
49
How to build a CMS in 8 minutes
07:55
50
Concept: Routing to add a custom CMS
01:18
51
What we'll cover
00:54
52
CSS Front-end framework survey
02:03
53
Introduction to using Bootstrap
04:51
54
Running in a real web server
01:00
55
Intro to grid layout
02:53
56
Responsive browser tools
01:13
57
Grid layout in action
01:35
58
Adding to the grid
03:25
59
Concept: Grid layout
01:44
60
Buttons and forms
01:15
61
Buttons and forms in action
04:48
62
Style the login form
03:32
63
Concept: Buttons and forms
01:31
64
Why Bootstrap themes are awesome
01:43
65
Bootstrap theme tour
05:45
66
Our site design
03:15
67
Home page HTML
05:12
68
The making of the hero
05:23
69
Stats slice
03:20
70
New releases
03:49
71
Adding the navigation
03:50
72
Final footer
03:57
73
Introducing SQLAlchemy
04:07
74
Who uses SQLAlchemy?
01:35
75
Architecture
02:14
76
The database model
03:11
77
Modeling packages
08:31
78
SQLAlchemy model base class
01:52
79
Connecting to our 'database'
06:01
80
Creating tables
06:27
81
Indexes
05:01
82
The rest of the tables
04:25
83
Relationships
07:17
84
Concepts: Modeling
04:15
85
Creating the basic insert script
02:19
86
Connecting to the database (again)
01:36
87
Setting package values
01:34
88
Saving the package to the db
03:37
89
Running the inserts
02:35
90
Adding type hints to the session factory
01:21
91
Inserting real PyPI data
01:39
92
Concept: Unit of work
02:23
93
Querying data: Home page
05:55
94
Querying data: Latest releases
09:04
95
Working with package details
09:19
96
Concept: Querying data
04:03
97
Concept: Ordering data
00:45
98
Concept: Database updates
00:49
99
Concept: Relationships
02:00
100
Concept: Inserting data
00:37
101
Introducing database migrations
03:47
102
Getting started with Alembic
02:32
103
Our first change
09:17
104
More database changes
05:29
105
Concept: Getting started
01:44
106
Concept: Alembic - the manual version
03:10
107
Concept: auto-generating changes
01:51
108
The basics of HTML input
03:14
109
GET-POST-Redirect pattern
02:36
110
Register for the site (getting started)
03:14
111
Registration form
01:43
112
A little design for the register form
04:45
113
Register POST action
02:44
114
Getting the submitted values
05:09
115
Creating the user
06:59
116
Login form
01:09
117
Login code
03:20
118
Creating a user session (cookies)
07:16
119
Navigation items based on user's session
02:54
120
One source of data
04:20
121
The motivation for viewmodels
02:50
122
Viewmodel base class
04:16
123
Using a viewmodel
03:19
124
The register viewmodel
10:24
125
Concept: Viewmodel
01:41
126
Simplified view methods
01:23
127
Viewmodel data exchange
01:45
128
Server-side validation with Viewmodels
01:37
129
Client-side validation with HTML5
04:55
130
Concept: Client-side validation with HTML5
01:26
131
Why write tests (web)
02:10
132
Special challenges of the web
02:33
133
3 types of web unit tests
03:09
134
Organizing your tests
03:00
135
Getting started with tests
03:46
136
Testing the register viewmodel
05:49
137
Avoiding the database call on register
03:26
138
Testing registration when inputs are invalid
02:26
139
Concept: Testing view models
01:34
140
Testing view methods
05:28
141
Concept Testing view methods
03:47
142
Integrated tests
05:40
143
The rest of the tests
02:29
144
Running tests outside of PyCharm
02:10
145
Concept: Testing the full web app
01:02
146
Pareto principle and testing with sitemaps
04:45
147
Deployment overview and topology
03:45
148
02-creating-our-linux-server
05:15
149
The setup script and config files
03:12
150
Configure the server
07:47
151
Make the virtual environment always active
01:44
152
Setting up our code
02:52
153
Running under uWSGI
03:28
154
uWSGI as a service
02:03
155
Running in nginx
03:30
156
Adding SSL with Let's Encrypt
03:58
157
Concept: uWSGI
01:20
158
Concept: nginx
01:19
159
Introduction to the NoSQL version
01:42
160
Not a MongoDB course
00:55
161
How document databases work
01:15
162
Connecting to MongoDB
04:56
163
The user entity with mongoengine
03:41
164
Saving a user
03:25
165
The rest of the entities
01:44
166
Rewriting our queries
06:01
167
Fixing the login
02:27
168
Importing the data from SQL to Mongo
03:21
169
Home page cleanup
04:52
170
Package details cleanup
03:32
171
Concepts: MongoEngine and MongoDB
04:25
172
You've done it!
00:41
173
Creating a new Flask app
01:01
174
Jinja2 templates and dynamic HTML
01:44
175
Layout pages
00:57
176
Routes
01:35
177
Themes
00:45
178
Querying data
01:10
179
Database migrations
00:39
180
GET-POST-Redirect
01:17
181
viewmodels
01:30
182
Testing web apps
01:03
183
Deployment
01:18
184
MongoDB edition
00:55
185
git the source code
00:23
186
Thanks and goodbye
00:23
Unlock unlimited learning

Get instant access to all 185 lessons in this course, plus thousands of other premium courses. One subscription, unlimited knowledge.

Learn more about subscription