Save this video free

CS50 Fall 2025 - Lecture 9 - Flask (live, unedited)

CS50 · 3:01:15 · Watch on YouTube

These notes were made with YouTube Collector. Paste any YouTube link and get the same: a summary, chapters and a searchable transcript.

Overview

CS50's Lecture 9 introduces web programming with Python's Flask microframework, synthesizing past concepts to build dynamic web applications. The lecture covers routing, HTML templating with Jinja, handling user input via GET and POST requests, session management with cookies, database integration using SQLite, and building APIs that return JSON data, culminating in a Frosh IMs registration system and a simple bookstore.

Key takeaways

Chapters

17:51 Introduction to Web Programming with Flask
19:18 Understanding URLs, Routes, and HTTP Requests
21:14 Creating a Basic Flask Application: Hello World
24:34 Rendering HTML Templates with Flask
29:10 Handling User Input with Request Arguments
34:30 Implementing Conditional Logic in Templates
41:00 Structuring Applications with Multiple Routes and Forms
44:05 Accessing POST Data with `request.form`
52:15 Combining GET and POST Logic in a Single Route
56:55 Refactoring Templates with Layouts and Blocks
1:01:55 Handling Dynamic Form Data with Checkboxes
1:07:20 Implementing Radio Buttons and User Input Validation
1:12:15 Improving User Experience with Error Messages and Images
1:17:40 Storing Data Persistently with SQLite Databases
1:21:55 Managing Database Records: Creating, Reading, and Deleting
1:25:35 Implementing User Authentication with Sessions and Cookies
1:30:15 Building a Login System with Flask-Session
1:34:20 Creating a Shopping Cart with Sessions
1:38:35 Displaying Dynamic Data in HTML Tables
1:42:15 Implementing Redirects for Better User Flow
1:46:55 Database Design: Normalization and Relationships
1:50:15 Implementing Deletion Functionality with Hidden Inputs
1:53:35 Securing Actions: POST vs. GET Requests
1:56:40 Consolidating Routes and Handling Multiple Selections
2:00:03 Leveraging Global Variables and Jinja Loops for Dynamic Content
2:03:35 Building APIs with JSON Responses
2:06:55 Implementing Autocomplete Search with JavaScript and APIs
2:08:35 MVC Paradigm: Model, View, Controller
2:11:55 Understanding HTTP Cookies and Sessions
2:13:20 Implementing Login/Logout Functionality
2:15:40 Building a Bookstore with a Shopping Cart
2:20:15 Advanced Search with SQL LIKE and Wildcards
2:23:20 Returning Raw HTML Snippets for Interactive Frontends
2:25:15 Serving JSON Data for APIs
2:26:40 Final Project Building Blocks and Next Steps

Keep these chapters and the full searchable transcript in your own library.

Transcript excerpt

18:07 All right, this is CS 50. This is already week 9, and I dare say this week is the most representative of what you'll be doing after the class if you so choose to program in the future and tackle some project that's new to you. In fact, the closest to this week was perhaps week 6, wherein we didn't really introduce all that many new concepts but really translated them from C into Python. And so this week, in particular, the goal is to really synthesize the past 10 weeks of class, drawing upon a lot of the building blocks that. Hopefully now, metaphorically in your toolbox and gives you an opportunity now to apply those ideas to new problems, in particular web programming. So every day you and I are using the web in some form. Every day you and I are using mobile apps in some form, and we said last week that the languages underlying a lot of those applications are HTML and JavaScript for the layout and aesthetics,

18:55 and then also in part JavaScript for a lot of the client side interactivity that you might experience nowadays. Well today we come full circle and bring back a server. Side component whereby we'll again write some Python, we'll again write some SQL code and use it to make our full fledged own web applications and in turn if you so choose mobile applications as for your final project as well. So up until now when we did anything with the web, you ran this command last week, HTTP server, which literally did just that. It spawned a so-called HTTP server that is a web server whose purpose in life is just to serve up content from like your current folder, any files they're in, any folders therein.

This is the start of the transcript. Save this video free for the whole transcript, searchable and time-coded.

Related notes

Summary, takeaways, and chapters were generated by AI from the video's transcript and may contain errors. The video belongs to its creator, CS50.

Want the full transcript?

Save this video in YouTube Collector to get its complete searchable transcript, your own AI summaries, and a library that keeps every video you collect in one place.