Returning HTML

Full Transcript


in our previous video we saw how to create a simple obligation returning just a string of course we will want to create more useful obligations I'm one of the features and we wanna include is returning eight

Jim Elson day markup language that can be interpreted by pros

we will see how we can simply return an HTML piece of takes us we were doing in the previews


we're going to focus now in her second example in this case is going to be the example inside O. two HTML inside here

the first thing that I want to show you is how I can schist

I commend these line commend these one save the file and floss will restart of web development server we down the

taking care of so I will just reload this page

and the delegation will be in Cali reloaded is pretty neat

so let's focus now in the actual file that we need to tune in this case is that eight oh two H. ten ounce have you mark

the first thing we see here is that we are schist lever shame on the powers flask of returning simple strings to create a more complex HTML string

so basically what happens here is that floss latest returns trains which are just returning back to the client nothing is stopping us from returning %HESITATION piece of HTML code

so us we can create a simple piece of HTML on returning from our function we wanna create a more complex application what we wanted to ease from a list of authors of career we received from our database we wanna show them in our web page

so I'm showing you first of the H. Tim Allen's kind to be structure how it looks like so you can just

open this simple the simple web page unseated by herself

then instead of that we want to do is remove these hard coded

HTML peace and construct a new one you seen pipe them we will combine the authors in this list with the %HESITATION stream and we originally have I'm we will finally returned

all that HTML code back toward Clark

we'll have to do some advanced stream processing to do these tasks and this is what we want to show you want to show you how difficult it is to manage trains in python by itself and how templates the subject of the next lessons is going to simplify it for ourselves

so the first thing I'm doing is I am creating these parents saying laced off offers with just a python piece of code that combines the author's return from these lists alright so this code and use your right here is going to create something similar to what we have

right here I have cysts included these simple brings Damon so we can see

obliga console divining longer to see what the actual after school east stream contains so I am not using these authors list yet I'm still using that hard coded least but I want to show us show you how does the authors list was created I wishes freeloaders page

and you will see right here in the console how they are first released he's created of course we are missing a few line new lines of but the content is going to be the same so our next step is going to be

B. two replaced his heart could at least by our news dynamically created

so what I'm going to do a issues and going to remove these

hard coded list I'm going to create a new for mining


I'm going to call the church hoppers Lacy hunt before returning to HTML

I'm just going to clog picked out first released viable to these authors


place holders I will also I could change for example day the name so it is not so confusing I could use

you all here I hear a confuse you L. so you see %HESITATION by yourself how it works if you're not familiar with Pikmin streams and formatting and all that please take a look at our vans PI think worse of because we have more to do details of our unique hoods train

so I'm just going to save these scripts on I'm going to go box or page I will reload a page and I will see how

they live in dailies is basically the same one

but I had to do is I'm going to create

%HESITATION I knew author here so I could do something like

on I will just say this script on the reload the page

and you would see how they

late late latest offer was you put it so I could for example remove these two authors

and the bass he's dynamic goalie shanor rated but check the source code of the space I will see you did I catch the amount that I generate if money only with these keys by Franco

so in this case we have done everything that we needed to create a full fledge well obligation we are sure switch

earnings are in HTML code which he's dynamically created so supposing that these

list of father sees read from a database we kind of have everything that we need

but of course DC's pretty annoying having to manage money all these trains is set task that is this in scale so we will see in the following videos how to create templates on how to leverage on the flask template a gene to create better solutions

thank you and see in the next one