#100DaysOfWeb in Python Transcripts
Chapter: Days 1-4: Flask Intro
Lecture: Day 4: Your Turn - What did we learn?
0:00 Congratulations you made it to the end of your first two days of the course. This was the introduction to the Flask Web Framework.
0:10 I hope you enjoyed it, I hope you got a lot out of it. Let's do a quick recap of everything that we learned.
0:16 What we're looking at here is the Flask package hierarchy this is pretty much how our entire application was laid out.
0:23 If you remember we started out with our project folder we created the virtual environment, we have our demo.py
0:30 file which tells the flask app what to run and we also have the flask n file there which was the actual environment variable for the flask app.
0:41 We then had the program folder, that's where our actual application lived, it was packaged within that
0:48 and that's denoted by the __init__.py file that tells the package what to run, what to import and so on
0:55 and it imports the routes.py file which contains all of the information for routing out applications so all of your routes, the app.route decorator
1:06 and what each one of those web pages actually does. We then have the templates folder which contains all
1:14 of those HTML templates including the base template which was the one that carried across all of our pages
1:21 and then we have our two unique pages, index.html and 100Days.html. Just looking at our __init__.py file quickly, we begin
1:33 by importing flask, that's the very first thing you have to do for this file, you have to tell it to import
1:39 the flask module from the flask package, and then we create our very own flask app object. So we get this app object and that's what's used throughout
1:50 all of our application. We then from our program folder we import the routes.py file, so thinking back to that hierarchy, from the program folder
2:01 we're importing routes.py. Looking into the routes.py file, we import app so again from that program folder we know because of the
2:15 __init__.py file that we can import our flask object called app, from flask itself we then import render_template
2:24 and looking down a little bit further, we then have our decorators, these are the decorators that sit on top
2:31 of our function, and these tell our function what path is going to work with that function and at the end of the function we then return the actual
2:43 HTML file or the template that is going to be used when that page is called. Looking to the base.html file now, this one's quite simple
2:54 nothing much to it, it was just some base HTML code with some Jinja code injected right into the middle
3:01 of the body tag, this again was the place holder of all of the content that we're going to be injecting into
3:08 this base HTML file, and that code that we're injecting in is our unique HTML files and looking at those unique HTML files, those other pages
3:20 we then have the extends Jinja code and that tells us what file we're extending from, in our instance
3:28 we're extending from base.html, taking that base HTML code that template, and using it for this other page.
3:40 The block content as we saw in the base.html file this is the code that's going to be injected, this is the code that fits within that block
3:47 content on the template and last but not least we then played with a little bit of MUI CSS, this is just a screenshot of the website
3:58 there's the URL down on the bottom, if you want to have a closer look, have a bit of a play. So now it is your turn, have a quick look at the video
4:06 again on the read me, or go and read the read me yourself on the actual GitHub repo but now it's up to you.
4:13 In your last two days you are going to make your own web application, the idea is to be completely free form
4:20 there is no rule around this, all I'd like you to do is take everything you've learned and make your own
4:26 website, make your own page, it doesn't have to be functional just as long as you are using a base HTML type file to have a template that flows
4:35 across all of your pages, do whatever you want come up with anything, make it as simple as possible it doesn't matter, just remember it's all about
4:45 the consistent learning, so day three and day four dedicate at least 30 to 60 minutes to just playing around with your own website and remember
4:55 keep calm and code in Python.