Welcome back.
What is this weird syntax?
In order for us to understand that, we have to understand this idea of a templating language.
You see, the power of flask is the fact that we can build things dynamically.
What do I mean by this?
Well, let's assume that in the body tag here.
I right to curly brackets like this.
If I do in here.
Four plus five.
And I save.
Let's go back to our website with our cool lightning bolt and let me close this for now.
If I refresh, I get nine.
Is that what you expected?
How is that possible?
Because if you're wondering, this isn't HTML.
If I did this in a regular HTML, it will just show the actual curly brackets.
Curly brackets, four plus five.
But something is happening here.
Flask looks at these double curly brackets and says, Oh, this is an expression, this is a python
expression that I actually need to evaluate.
And this is actually the exciting thing with flask underneath the hood.
It uses something called Jinja, a templating language.
It's a way for us to do this.
And Flask comes built in with that.
So if we look at the fab icon, what we just did is we've used Jinja to say, Hey, I want you to evaluate
this as Python.
So if I copy this and I go to server py.
And in here, let's just do a print and paste this in.
That is the exact same thing that we added to our HTML except for we now need the URL for that comes
with flask.
Let's move this here actually.
Inside of the route.
FY refresh.
I see over here that I get static.
Bolt ICO.
So it's printing the actual URL.
Static slash bolt iko.
Now I could just technically have copy and pasted this and just done this whole thing as a string instead
of using your URL for.
But if you go to the documentation of flask, it talks about your URL for and why it's a good idea to
build a URL instead of coding them.
And it gives you actual reason of why you might do that.
For now, you can just think of it as a safer way to build URLs.
So that's all we're doing.
We're essentially saying grab the bolt icon from the static folder and we're able to do this through
this templating language.
Very, very cool.
And now we have an extra power in our tool belt.
That is, we're now able to dynamically update parts of the page.
What do I mean by this?
Imagine if our super cool website.
When I actually refresh here gives me the username of that person.
For example, if I request for the blog of Andre.
And I hit run.
Ideally, I'll say Hi, Andre, and then maybe show my blog post using Flask.
We can do that and let's find out how to do that in the next video.