Transcript from the "Flask Practice Setup" Lesson
>> Nina Zakharenko: And all of that leads us into our final exercise. So for intermediate Python, go to Chapter eight, the final exercise. We're going to build that basic web app that we saw earlier. And let me kill this one and bring up the window where I had it running.
>> Nina Zakharenko: So this basic web app, sorry,
>> Nina Zakharenko: Allows us to select our languages via checkbox and hit Submit, and with each submission, we don't have a database, we're just hitting the GitHub API. So for the few of you folks in class, as you build this, if you kinda really mash all the buttons, you might hit the rate limit, so just something to be mindful of.
[00:00:54] And I can go and hit this API filter by whichever language I want.
>> Nina Zakharenko: Okay, for this exercise, if you go to the class website, you should have flask and requests installed already. If you don't, you can take a look at this requirements.txt file that I put in with my package.
[00:01:30] And this file is in the course repository, so if you get poll, you'll get all the latest changes. This lists all of the libraries that are required to run my program. You can even peg these to a specific version with a double equal signs if you want to, just an example there.
[00:01:49] So if you didn't have the required dependencies installed, you can do a python -m pip install and then pass the -r flag to specify a file. Once you advance in your Python journey and your requirements become more complicated, you can use the more advanced pipenv tool to handle complicated dependencies.
[00:02:13] So just an important thing about this final exercise. Download the zip file that contains the static files for this application. And just like the templates directory, where Flask just knew all my templates just lived in there. For our static files, we have a static directory, and Flask just knows that those are static files.
[00:02:36] So I'm going to provide you with a CSS file and an index.html template that does the ginger templating for you. And you're gonna write your own flask routing that takes, the route is gonna be at the root URL, or that route is gonna accept a get and a post, right, when we submit a form, that's gonna be an HTTP post.
[00:03:05] When we first visit the page that's just a get, and you're gonna build that along with the static files that I provide. You're also gonna use some of the things that we learned earlier. So, our GitHub repositories, those are gonna be stored in our own class. We're gonna throw a custom exception.