CS50 Lesson 9 (Flask)
In this lesson, we are introduced to the Flask web framework, which allows web developers to create and manage routes (such as /
or /login
) - serving unique HTML pages based on the route that is reached. Building upon previous lessons, the instructor walk through how you can use Python to handle some logic within Flask, as well as run SQL statements and generate corresponding output in HTML templates that are using a Jinja templating syntax.
The intructor constructs the lesson around a simple app that allows a student to register for a sport. By the end of the lesson, he's built the webform, defined the route for it to submit to, where it does some error checking before submitting the registration to a database and acknowledging success.
We also discuss 'sessions', where an extremely simple shopping cart is created, and finally, by using Ajax, we're walked through how to create an autocomplete form based on the TV shows database from a previous lesson.
It glosses over huge amounts of information, but whets the appetite for coding apps, seeing how easy it is to string so many different ideas together. Much like me following Wes Bos's Advanced React course right now, there is quite a bit of, "Now I'm just going to type this here, and just know that you had to read the documentation already to get this far." This is the nature of the beast - it comes by doing and reading, not just by watching the lesson.