Hey, welcome back.
In this video, we will write some code in between these two lines.
So in this line, we created an app instance using the flask class.
So this represents the instance, the app, basically, and then the app runs here.
So that executes the web app so that we can visit that web app through its URL.
Now, in between here, we want to handle those HTTP requests.
So let's start with the first request app dot route.
Let's handle the home page.
The home page is represented by this slash.
So if you were to handle another page such as your URL, slash my page, then you would have to write
here, slash my page.
But now it's just a slash.
So with that, that's a decorator with that symbol, we are writing a decorator and that decorator here
will call this function.
Let's call this function index, right?
And so when the user visits that web page, we want to return the index dot HTML page index, dot HTML
page.
But we don't do this.
We do something else.
I mean, you can do this actually, but you will not get the expected results.
Let's try this.
So let's run the app.
Right.
Go here, reload.
So make sure you are reloading the home page.
That one.
This is what you get.
So that index.html is simply shown as a string.
So this is just a string.
It can be anything, right?
So if you do that reload, you say you get anything.
Right.
Now what we want to do instead is we want to say render template.
This is a function, but we need to import that function from flask.
So from flask import flask comma render template.
So there we go.
And then if we reload the page now we'll get nothing because there's nothing inside index.html.
So let's write some HTML code here.
HTML starts with that doc type.
HTML tag followed by an HTML tag.
So opening the tags and closing the tags with this slash here and in between goes the body.
So make some tabs here.
Use tab to indent and let's have a heading here H1.
Job application form.
So now I can go here.
I can simply refresh with Ctrl or command R and we'll get that heading here on top, right?
So this is the visible part of an HTML page.
Whatever you put inside the body tags, you'll see it on the web page, but there are some other metadata
you need to input and you do that inside the head tags.
So.
Right, some head tags, opening head tags and closing head tags.
And in between these two, you want to have a meta tag.
You want to specify the character set at UTF eight and close that tag.
So meta tag.
And you need another meta tag here which specifies the viewing options of your app, such as the parameters
of the width.
Initial scale set it to one.
Shrink to fit equals to no.
And then close that meta tag.
So this makes sure that your app will work well in many browsers.
So that's about the HTML document for now, you can find this HTML code attached.
So the index.html file attached in the lecture resources.
So if you don't want to type those in, just copy paste my code.
So let's try to see if everything works fine.
Yeah.
So as I said, this is in the body text.
So that's the visual part, the visible parts and everything you have here.
These are metadata which indicate the behavior of the browsers, how the browsers should handle your
web app.
So that's about this lecture.
Our Flask app is running, so now we're ready to add some more content to the HTML front end.
So which is those input fields of our application form, the job application form.
So let's do that in the next video.
See you.