Skip to main content

Building data-driven web apps with Flask and SQLAlchemy

9h 38m 43s
English
Paid

Course description

One of the areas Python really shines is in building clean and powerful web applications. Once you know the language basics, this course will teach you everything you need to build data-driven, modern web applications in Python with the Flask web framework. Full stack web development is exactly what you need to build true data-driven web applications in Python. Yet these courses can be confusing and overwhelming due to the many technologies involved (Python, SQL, CSS, etc).

Read more about the course

Source code and course GitHub repository

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

We have taken great care to build a course that is just real enough to give you what you need without anything extra. We build a replica of a popular web application, Python's own packaging index over at pypi.org.

While building our replica PyPI, you will learn:

  • Learn about the different major Python web frameworks
  • Create a Flask-based website from scratch using the CLI and PyCharm
  • Work with dynamic HTML templates
  • Map URLs to view methods using routing
  • Make advanced use of routing to build a full custom CMS in 8 minutes
  • Take advantage of bootstrap to build well designed sites
  • Map data to and from Python using classes with SQLAlchemy
  • Learn how Alembic can help our database evolve as our models change
  • Accept user input with HTML forms
  • Add client and server-side validation
  • Overcome the special challenges of testing web apps (databases, frameworks, etc)
  • Deploy our web application to a fresh Linux machine (virtual, cloud-based)
  • Leverage our design patterns to convert our app to another data model (MongoDB edition)

Who is this course for?

This course is for anyone who wants to create Python-based web applications using the Flask web framework. In fact, you'll learn a lot of web skills that will translate across frameworks as well.

We do assume that you have basic Python language skills and can read HTML and CSS. But most advanced uses of the language or CSS are explained in the course.

Watch Online

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

Comments

0 comments

Want to join the conversation?

Sign in to comment

Similar courses

Beginner Python Primer for AI Engineering

Beginner Python Primer for AI Engineering

Sources: Towards AI, Louis-François Bouchard
Don't just interact with LLM models - create your own AI solutions in Python. This course will take you from beginner to confident proficiency in Python...
1 hour 41 minutes 58 seconds
Airbnb App Clone

Airbnb App Clone

Sources: Nomad Coders
REST API, GraphQL API, iOS / Android App. Make Airbnb App with Rest API and GraphQL API. Users can search, look and browse various homes..
17 hours 50 minutes 5 seconds
Introduction to Ansible

Introduction to Ansible

Sources: Talkpython
A course by Matt Makai of Full Stack Python for software developers who want to learn the Ansible configuration management tool for managing servers, deploying web applications ...
2 hours 54 minutes 19 seconds
Data Science Jumpstart with 10 Projects Course

Data Science Jumpstart with 10 Projects Course

Sources: Talkpython
This course will empower you with the skills and tools to dive deep into data science using Python. We assume you have a foundational understanding of Python but not data scienc...
3 hours 12 minutes 21 seconds
Contact Tracing with Elasticsearch

Contact Tracing with Elasticsearch

Sources: Andreas Kretz
In this exciting engineering project, you will learn to track user movements through their phone scans. The goal of the project is to use...
1 hour 37 minutes 3 seconds