Placeholder Image

字幕列表 影片播放

  • All right.

  • So, uh, welcome back to another stream and another video.

  • What I've done now is I've created just a little bit of, ah notes for my intro because I just wanted to mention something a little bit quickly before you get started.

  • Because today what we're gonna do is we're gonna try to build out the wrist a p i for this app that we've been building the last couple of days, the last couple of videos and, uh, what I wanted to mention before we start.

  • It's just that I'm not an expert at this and, like building rest AP ice is something that is completely new to me.

  • So are built somewhat of arrest FBI like, two times before.

  • I think, using flask and python, which is what we're going to use today as well.

  • For this rest a p I and ah, also as like, kind of the purpose of this series or this stream.

  • The stream sessions is to show for me to basically be ableto build this app, which I would have been building anyway.

  • So I think that I sense I would have been building this app.

  • Either way, it makes sense to just share it with you guys live so that you can see kind of the entire process of me building, building this out and just me making mistakes and trying to figure out how to solve these different things.

  • Um, so let's let's take a look again at the notes.

  • So what I try to do hard with my normal videos I do on YouTube is I really tried to show that I like exactly how it is, how good or bad I am a coding.

  • But it's sometimes one of those things where if a video turns out to be like 30 minutes long and 15 of those minutes is being spent just on the same problem over and over trying to solve it, I might have to cut that out just because a 15 minute video tends to do a lot better than a 30 minute video.

  • So I try to keep them short.

  • So but I tried to keep in some errors that I do just to kind of show a realistic picture of what it looks like when I code, and what I've been getting the impression of is that some people seem to think that I'm like some god when it comes Thio programming encoding.

  • So and that's not really the case that old.

  • And that's kind of why I feel like this.

  • Siri's is a good way to really show exactly how it is and exactly what it looks like.

  • I don't catch anything out, and it's just what I'm doing here is exactly how good or bad I am a coating which I think is really good.

  • I think I haven't really seen anyone else do do an entire live build oven app from zero to a complete finished app that's published s Oh, that's also one of the ideas with and then also this stream kind of build some interest, hopefully in the apple on building, so that when I do really sit, maybe some some of you guys will want to download It s so that's kind of the idea with it anyway.

  • And I also consider these streams not just pure tutorials, since I'm also learning these things myself as I'm building it out, I consider him kind of a mix between tutorials and also kind of just hangouts where I'm coding.

  • Maybe you're following along and coding along with me.

  • Or maybe you're building something else out.

  • Maybe you're just having this on in the background, so it's not as formal.

  • It's like a tutorial, since I'm actually, like exploring some of these things myself in the stream.

  • So with that said a little bit of a long intro.

  • But now we're gonna get into actually building out the rest A p I So what I've done, Yes, I've created a I think I mentioned this last time in the last stream or video, and that is that I've created kind of an outline for what I think we're gonna need in order all of the classes and, uh, then so this is essentially what we're gonna have to build out today.

  • We're gonna try to get the daughter base set up and then also get in to get the flask app up and running, and then we'll go through and try to create all of classes that we're going to need and then insert that into the table and kind of get the very, very basic functionality of the A p I or daughter base up and working.

  • So we're going to start with just creating the daughter base, and we're gonna use prosperous.

  • So they're different types of daughter basis You can use sequel is like the main one, as far as I'm No.

  • So I'm going to use pasta, Chris, which is called, like, cost gris Que el, which is based on the X SQL language.

  • So what I'm gonna do is I'm gonna first start by just checking how to actually create the daughter base, because I don't remember that command.

  • Um, because I think you can just start it straight from the terminal.

  • Okay, I think this is the one what we'll call it ISS productivity, huh?

  • So this command should create a new, uh, daughter base for us called the daughter base will be called productivity app.

  • And I also think that it will open up the daughter based for us so that we'll get actually into it.

  • I'm not quite sure, but I think it's yet no involved.

  • Argument.

  • P s U l Okay, copy.

  • The wrong one changed the year, sir.

  • All right, maybe we'll just open a prosperous, and then we'll go into it, and that will create the daughter base inside.

  • Well, just make sure that we actually have it.

  • Okay, so we have it running.

  • Okay, so now we're hitting the daughter base.

  • Now, we just need to create the daughter base.

  • Uh, all right, create right.

  • Three.

  • Thought obeys.

  • And then now we can name it.

  • So product Thio too.

  • Uh, all right.

  • So this should then create our daughter base for us, which I think it did now, because wait product to the, uh I think you always have to end it with something like that.

  • Syntax, error near.

  • Create.

  • This is something that I yeah, sometimes.

  • Which I'm not sure why, but sometimes when you paste or when I paced, it tends to not work.

  • Even though it's, like, spelled correctly, we're gonna try it with lower case.

  • Should work with Lower case is well, I think product to be, uh, shit, uh, create allo bays.

  • All right, Why did that not work, All right.

  • I think at Nino seven, if that's what you say.

  • I think that's Yeah.

  • All right.

  • So we created the daughter base.

  • Um, how that works.

  • See, everything's gonna be a little bit of a struggle right now because I'm so not used to this.

  • Um so therefore, the kind of spiel at the beginning.

  • Um, all right, it's No, We've got our daughter based created.

  • That was essentially all that we wanted to D'oh.

  • Now we can get into the more of the flask stuff.

  • Um, all right, so what I did was essentially just Googled rest a p i with python and flask.

  • And, uh, we're going to follow this a little bit quickly through and just get it set up.

  • Um, all right, we're gonna open up a new terminal window, and then we're going to go into our project.

  • Uh, what was this one cold again?

  • It was called.

  • What do we call it to Dio Much?

  • Yeah, I think they called it to d'oh.

  • To Dio.

  • Yeah, right.

  • So, no, he creates a new directory cold back.

  • And we're just gonna be where you keep all of the back end stuff.

  • And you do get, uh, uh, back and okay.

  • And then we have that.

  • Now we go into back end, and then we open this up in visual studio code.

  • Okay, there we go.

  • You're gonna have this here for now.

  • Uh, what I think we need to do is we need to create a virtual environment as well.

  • So we'll create a virtual environment.

  • Pull that end, enter and then that should set that up.

  • All right, so now we have the virtual environment.

  • Now let's go into its source, and and then what is it being activates?

  • And then now we're in our virtual environment, and that is just so that we can install some of the things a little bit more specifically to this project.

  • Okay, Now we'll follow this.

  • Make their part, isn't it?

  • Make every sources okay.

  • I'm not sure that we're gonna need the Hello Don Pi on the following too.

  • Apartment stop text.

  • Okay, so this is what they outlined that we're going to need.

  • We're going to need all of these different files, essentially, which is gonna be wrapped up by migrate Popeye model a pie and requirements text and then run.

  • Dupuy, I think that this part of it is just for like, I think it's gonna be a basic website or something like that that they've got.

  • So I'm not sure that we're gonna need that.

  • Um, all right, so we're gonna just go ahead and add all of those files.

  • Yep.

  • We're just gonna have the files.

  • All right.

  • Um, there we go.

  • Lets out a file pie at another one.

  • What about this one?

  • My great pie.

  • I think this is the one that migrates.

  • So you basically create all of the stuff that's gonna get put into the daughter base within the python or the flask, and then what you do with you, I think you run migrate dot pie.

  • You do it with some in some special way and basically that lead insert all of the tables and all this stuff into the daughter based for us, so we don't have to do that manually.

  • And yeah, I think that's what migrate up I will do.

  • And then we have modeled a pie.

  • But we're going to call that mo dose.

  • Don't lie on DDE.

  • Then we're gonna have requirements.

  • Rick.

  • Oi!

  • All right, tucked out.

  • Okay.

  • And then we'll just add all of this stuff into the requirements that takes, like they said, save that, and okay, they're just explaining all the packages, which we don't really care about.

  • Okay.

  • And then Pip in stall requirements.

  • Okay, that will Then go ahead and stole everything for us.

  • Okay?

  • then we should add config.

  • Duck pious.

  • Well, and then we'll add whatever he said we should add into that one.

  • I'm not sure how interesting this will be.

  • This is just going to essentially be me setting everything up.

  • Um, which isn't super interesting.

  • I don't think, but this is also like I said, I wanted to build everything out live.

  • So we're essentially building everything out.

  • Live conflict a pie import.

  • Okay, copy this.

  • And at this to convict on fire, we're gonna rename this, uh, fraud activity.

  • Okay, so we're essentially before it's a daughter base or something like that.

  • We rename it to the daughter based name that we gave our rescue, and always, uh, not sure if we need thio actually replace anything here, but we'll see what happens when we test run it.

  • Uh, okay.

  • Create the after pie entry points.

  • A guy from resource is does.

  • Hello.

  • Okay.

  • We're just gonna see what they add to a low and then depending on what they add.

  • Hello, DuPuy class.

  • Hello, resource.

  • Definitely itself.

  • Return message.

  • Hello, World.

  • Okay.

  • In a low class, we define the function.

  • Get this means that any get requests on the helo en pointe will be hitting this function.

  • Okay, I think that's actually a good thing to have, because from what I understand it, it's going to be essentially that we add end points here and that will then call all of these or this file.

  • So essentially here, we can add all of the get get put post delete all those requests.

  • There are different types of requests that you can have when you make an A P.

  • I request.

  • So, uh, essentially, it's kind of good to have them all structured in a nice way.

  • So we're gonna actually create that folder.

  • I'm gonna call that Reese or says, and then within these folders is where we're gonna have all of the separate requests.

  • So essentially for are up for the purposes of our app.

  • Let's say that we want Thio at a new task.

  • Okay, we we can do a couple of things.

  • We can add a new task or a new project.

  • Let's say, um so essentially, then we would have one of these classes here and one of these files for adding a new task and then a separate file for adding a new project.

  • So in that way, within separating them so that it doesn't become a huge long file off all the different in points that we have and all the different get and put requests.

  • Um, I think it'll make more sense once if you don't understand this right now, I think it'll make more sense.

  • Once we actually get it a little bit up and running on, we contest it.

  • So, uh, we have resource is right now what we're going to do inside resource is we're gonna add task pie and this Essentially, I think we're gonna add all of the different end points based on or the files that were gonna adhere are gonna be based on all of the classes that we decided we're gonna have.

  • So we're gonna have projects, support file.

  • And you, sir, because what you can do from the apples, you can either get a task.

  • You can get the project, you can get the support file, you can get you serve and as you say, as you see what they said here here in the helo class, we defined function.

  • Get this means that any get requests on the helo end point will be hitting this function.

  • So any time we want to get something that is related to the helo class, way will rule.

  • We will essentially be calling this file of this class.

  • So, um, therefore, all of these things, we can do it.

  • Get request for all of these different things we can get.

  • The task at the far does get the sports car, get the user.

  • So therefore, it makes sense to have separate files for all of those and create different classes for each of them.

  • All right, you file stuffed pie, you, sir.

  • Hi.

  • And support file A swell.

  • All right, so now we have all of that.

  • What we're going to start with, I think we're going to start with you, sir, because it's a little bit simpler.

  • Okay?

  • Import this into our years of class and what we're gonna do before we continue.

  • We're gonna just change this stuff out for you, sir or something.

  • You, sir, on Dhe from a sick you see up here, it says from really sources dot Hello, Import.

  • Hello.

  • What we can do and then is speaking coal from resource is thought to you, sir.

  • Wait.

  • Okay, so lower case because we named it lower case and then import for you, sir.

  • Right.

  • So now we can then create our class for the user class.

  • You served sores, okay?

  • And then we can define all of the different requests.

  • Gift.

  • You can also have a post post.

  • And, uh, yeah, there are different several different types that we could use, But we're probably where you're just going to start with this.

  • We're gonna make it a simple It's possible.

  • Thio, just get it off.

  • Um, so if you need a post my flu, you'll do something like post.

  • Okay?

  • Finally, add the following to run pie.

  • Copy this.

  • Added Thio.

  • What?

  • They we didn't create the run.

  • Dupuy.

  • Alright, let's create that file as well, Ron dot pie.

  • And now that is within our resource is which we don't want.

  • Okay, Rhonda Pie paste.

  • All of this.

  • Let's the okay.

  • I think that is all that we need from your terminal.

  • Make sure you are on the roof older when you run this command.

  • Okay, so we'll do that.

  • What do you run?

  • Python Rhonda pie file.

  • Run A by line 17 creates missing in the package or module path about finances much man taking.

  • All right, What did we miss?

  • Let's take a look at the after.

  • Pie in on the comfy file face import error.

  • No module named conf Age.

  • No money.

  • Okay.

  • Thank you, guys, for, ah, um keepin me or check in helping me out.

  • So I basically renamed or named it wrong, which is typical, isn't it?

  • Typical of me at least.

  • All right, so that should now work.

  • Come on, get it together.

  • Okay.

  • No module.

  • Need you, sir.

  • Okay.

  • Again.

  • Named that wrong.

  • Okay.

  • Great source.

  • Okay, let's just try this.

  • I'm not sure that that will change anything but important on no Lord.

  • Yes, Class.

  • Hello.

  • Resource itself.

  • Yes, Everything source.

  • Okay, I see.

  • After pine.

  • Real sources since backed up by resource is import.

  • Okay.

  • Resource is important to you, sir.

  • Okay.

  • From resource is no module named resource is stopped.

  • You, sir.

  • All right.

  • Not sure why?

  • This is not working, but let's it's a head.

  • Let's copy all of this pace that here.

  • You, sir.

  • You, sir.

  • Year, sir.

  • Let's just leave that.

  • Is that okay?

  • So now we've, at least on that, um, that's a roundup.

  • no.

  • Okay, coffee.

  • All that added to the user and just changed the name here.

  • Okay, so it still doesn't work.

  • At least now I've copied everything.

  • So now it should be It shouldn't be at least spelling errors unless their spare spelling errors in the what he's put out here, which I mean, there might be.

  • But the question is, why does this not work?

  • Resource is, don't you, sir?

  • Okay, let's just copy that on DDE.

  • That's a really name.

  • This file here.

  • No module neighboring sources.

  • You, sir.

  • Okay, No module named resource is bye.

  • How?

  • Oh, okay.

  • Maybe if we go further down.

  • Because sometimes I followed one of these ones before, and what I noticed was that I didn't get it to work either the first time, and then I scrolled down into this tutorial and, like, way, way down.

  • I really I saw that, Okay?

  • There was a an import that they had done that.

  • Ah, I hadn't done because they didn't show that up top.

  • So therefore it didn't work, but at the bottom, they had it.

  • And they didn't really say that.

  • That was something that we needed to add.

  • So sometimes it could be that they've just missed some import by.

  • This seems like another problem, because it's like it doesn't really.

  • It doesn't see that we have this fire, this folder here, which I'm not sure why.

  • Because it should see that, shouldn't it?

  • Resource is important.

  • You, sir.

  • Okay.

  • What?

  • We're gonna d'oh import files from folder four.

  • Oh, all right.

  • This is one of those tiny, tiny little issues that's like going to take up the holes, take up a lot of time.

  • Really?

  • Um, okay.

  • Abduct pie.

  • I really like This is where we're running into problems were not able to import it.

  • We're not able to see this folder resource is which we should be able to say.

  • Um, yeah, no module named Resource is that's Google it.

  • All right, let's see.

  • Run high.

  • All right?

  • Based dear, The thing is like, if we just do this, if you pull this thing out here, I think it will work.

  • Yeah, so now, now it gets another error, but it dozens, but it doesn't give.

  • So now it Apparently I would assume that it finds this file.

  • So the only issue really that we have is that it doesn't find it within, Um, the folder move.

  • Okay, let's try this Chris or stuff.

  • Okay?

  • Now it doesn't find it again.

  • Um, what we're gonna do is we're gonna move that out then of that folder just for now, because that a d least that way we can keep going and work on the other errors that come up.

  • All right, Uh, next error after equals, create up.

  • Import our normal no module named model.

  • Okay, I know that one should be simple.

  • Um, where are we Model here.

  • So we just do model models filament even.

  • All right.

  • Cannot import.

  • Okay, but let this because we don't have anything there.

  • Okay, we could just comment that out, because that is gonna be for when we actually have the daughter base.

  • Okay, so now we get the server up and running.

  • Now, we need to figure out how to actually have this file in that folder because really wanna have it in that folder, because otherwise it's going to get super Missy having just everything out here.

  • Essentially, what you want to do when you're building anything is just, like almost have more folders than you think.

  • You need.

  • So, uh, yeah, that's what I would suggest.

  • Okay, figure out this problem now, set at it.

  • Are you being told?

  • But the moment on, we shoot poisonous empty before we set the place on back.

  • Correct lead fail with export python path.

  • All right.

  • Not sure.

  • I'm not actually sure what I'm doing right now.

  • I haven't done this before, so brace or stop you, sir.

  • But I'm thinking that what I'm doing is I'm sitting like the bass directory that it's gonna look through.

  • Uh, not sure that the code is gonna be needed, but we're gonna try to just run it now.

  • Okay, No more Joan named free Sources that pie.

  • What?

  • We're gonna d'oh!

  • Export.

  • What?

  • All right.

  • Still can't find that file, which it's a bit strange running useful function.

  • Okay, turn off, export, But I mean export.

  • Okay.

  • Why does this not work uses?

  • All right, how highest is not working?

  • All right, I'm gonna listen to you mirror Shon di O or whatever your name is in the chat, create a new empty file that called in its dock pie.

  • All right, we're gonna do that.

  • I will try anything at this point and it's the pot inside.

  • Resource is yet I got it.

  • All right.

  • What are we doing now?

  • Okay, it worked.

  • Thank you for that.

  • That was super helpful.

  • And thank you.

  • Thank you for that.

  • There we go.

  • We have that running.

  • Okay, let's Let's just forget that ever happened.

  • And now we're gonna pretend like I'm an awesome coder again, and we're gonna move on to the next thing.

  • Okay, so we got that working.

  • That's out of the way.

  • Don dusted.

  • Let's go.

  • If we go to our local host now, we could do this.

  • Essentially, what we're doing is for accessing our end point.

  • Is that capital letters?

  • Even the capital letters not found.

  • Your elms are okay.

  • Where?

  • Okay, maybe we need the local host thing.

  • That part of it.

  • Let's Poppy, this and that here.

  • I don't think we need that, but okay.

  • No, this is Hello.

  • Okay, let's just go to the editorial, see what they say.

  • No, A P I Okay, that's why.

  • All right, so there we go.

  • We get the message here.

  • Hello, world.

  • Finally we get some actually, actual output from this thing.

  • Now what we can do is We can change that.

  • We can say hello, cow.

  • Something like that.

  • And if we go back here now and enter it again, it's a Hello, Cal.

  • Instead.

  • That's working now.

  • Great.

  • Oh, my God.

  • All right.

  • Next thing is going to be I'm assuming creating the models and actually adding it to the daughter base, which is what we're got here.

  • So okay, we're gonna import all of this into our models pie, right?

  • Save it on and then we'll take a look at what they've got here, okay?

  • Don't what I'm looking for right now.

  • It's just to see where they create all the classes.

  • Because I have already done this before.

  • So, uh, what?

  • I'm looking for us just to see whether they do anything different, but it doesn't seem like they go through.

  • Uh, this that much.

  • Maur comments came on my true.

  • Okay, So what I've done is I've prepared or for the other app that I've done, Which is this one?

  • I've already created different things for you, sir.

  • No.

  • Okay, so we import that you're on.

  • Okay, maybe we actually need to follow this just to see that we're actually doing it.

  • the right way.

  • Okay.

  • Category self.

  • Don't name serialized.

  • Okay, so I think we're gonna copy this one.

  • Or maybe let's copy this one, because that has a little bit more stuff in it.

  • Okay.

  • And then we're going.

  • Thio, where were we?

  • This one?

  • All right.

  • And what we'll do here's will paste this thing in.

  • So this is a classical Coleman's and what we wanted.

  • Okay?

  • Yes.

  • Oh, that looks pretty much exactly like this one, actually.

  • So we can just copy this.

  • And this is for another app that I created cold, which was the startup up that I'm still working on.

  • But it's like I've worked on it for a while, so I'll give you an update once I get back into that.

  • All right.

  • Uh, so we go, You, sir.

  • Daughter.

  • Base model.

  • You, sirs, is what that?

  • So we defined the table name.

  • So that is what if we go into our post arrest database, then we're gonna have different names for all the different tables on.

  • Duh.

  • Essentially, this is going to be named users, and that's gonna contain all of the uses for you.

  • Source for up, and then we have a table or eggs?

  • I d use her name.

  • I'm not sure what that wasa actually.

  • Let's take a look.

  • All right, so anyway and then unique constraints.

  • I d use your name.

  • Then we have the idea of the user, which is a string, and that's a primary key.

  • All of these things is not super important right now.

  • They're a little bit advanced that I don't know.

  • I don't know them enough to actually be able to explain them in a way that would make sense.

  • I don't think.

  • But I think that a primary KIIS, like essentially, when you want to get something from the daughter base, you need to provide something so that you can then tell the dollar based, like what are you trying to get?

  • So let's say that we when you want to get something from the daughter but database you type in select so like and then you can type in some sort of like a condition where you want to select something.

  • So let's say that you want to select a yusor where the user name is equal Thio cal or something like that, then you can provide that here.

  • Not sure Let's just look that up quickly.

  • So, like from daughter Bays s Q L Okay, so what we could do, for instance, we could do select star from, um that's a tasks Where, uh, you, sir, I d Let's say iss equal to for what we say.

  • Yeah, so where use our d a.

  • Is equal to 12 or some like that.

  • Uh, this I think this is the rights in texts.

  • Anyone in the chat that knows this better than we can feel free to just jump in if I'm doing it something wrong.

  • But essentially the details of exactly how you right this is not super important.

  • Like, you see, I just google it and I can find out how to actually do it.

  • But what is important is like when we want to get something from the daughter base.

  • We essentially this select star select everything.

  • So this then will select every task from our table called tasks where the use our d a sequel to 12 so or where you could also do where user name is equal to Cal, which is what I use.

  • That's the example just before so essentially what this would then do it still gets all of cows tasks, and it will display.

  • Yeah, so basically get all my tasks.

  • And Ah, this is essentially how you get stuff from the daughter base.

  • And ah, let's say that, for instance, the reason that we want to use an i d for are you, sir?

  • It's because just using the name of the user is not unless you're having, like, a user name which, uh, in a normal act would be actually unique.

  • What you want to do If you want Thio, let me try to refrain this so that I make sure that actually explain it.

  • Right.

  • Um, for instance, if we want to select every tasks from the user's where the user name is equal to Cal, there might be several different people called cow in our database.

  • So that means that we might actually get not just my tests.

  • We might get, uh, Cow X and Cal Y and Cow said, You know, like several other uses with the same name or with the same first name, we might get all their tests as well, which is not what we want.

  • Do we want to get the tasks for that specific user, which means that we need something called a primary key, which needs to be unique in this case if we want to be able to actually get just the tests referred to or the tasks that this specific use our house.

  • So that's why you sometimes see, like, the different long ass, uh, ideas for different uses and things like that.

  • For instance, if you go to YouTube and then you go to a video or something, then you have something in the earl that would look something like this.

  • There will be some part of the Ural that looks something like this, and I'm guessing that's like the video I d or something.

  • And that needs to be unique because we can't have two videos with same I.

  • D.

  • Because then if we request that video, we might get either off the videos because essentially two of them have the same name.

  • So therefore, some of the case that we have, or some of the fields or yet fields in our daughter base will need to be unique so that we can actually get so that we can get the specific ones that we want that was a long explanation, but I think I think it's kind of I hope you kind of understood what I meant.

  • All right.

  • So therefore, we need an I d.

  • That has to have.

  • That has to be a primary key.

  • And it has to be unique.

  • And that means that we can then use this I d to get daughter that is related to one specific yusor.

  • And the username is also a primary key.

  • Because what I want in the in the office for the user name to actually be unique because I don't want you to be able to have three people with the exact same username in some maps.

  • That doesn't really make matter.

  • So you can have this not be a primary key, But then the first name last name that's just gonna be a string password is just gonna be a string email address is just gonna be a string as well.

  • Let's take a look at our class here last night.

  • Password email a p i ke right.

  • Something that I I'm not very familiar with either.

  • But is something that I think we should have a swell.

  • It's called a P.

  • I ke, and I'm not sure how you would actually type this in, but that is what we essentially we're gonna use so that we can access all of the difference.

  • I guess the user i d could be an A P I t.

  • In a sense, but I think it makes sense to have to, um and what the A p I ke does is essentially it authorizes the use or for us.

  • So, for instance, if you have a nap and you go into it and you don't have to log in new anymore, that is because you've got an A p I he stored probably on your device.

  • I would guess again, I'm very new to this.

  • I'm not sure exactly where it gets stored, but I think it's stored locally on your device.

  • And as soon as you open up the app this a p I he gets sent to the daughter base or to the FBI, and then it basically authorizes you for yeah, just the authorization for you.

  • So you don't have to again type in your email address and password or use the name, password, whatever it is and what this then will do is they will go to the daughter base.

  • I think the way to do it in the right way is to kind of hash it, which is a little bit.

  • I don't think I should explain that because, like essentially, what it does is it takes, Let's say that we have a long number.

  • Uh, let's open up sublime text and have nothing.

  • Your note.

  • All right, so let's say that we have a long I d.

  • Here.

  • What's a hashing function will do?

  • Is it essential?

  • Essentially go through this entire thing and then for each, I'm not sure exactly what's there.

  • Different types of hashing functions.

  • So I think you could do more advanced, less advanced.

  • But the base principle is essentially will take each letter or something like that, and it'll multiply it or we'll do it.

  • We'll do something to it, which will make it into make it represented by another number.

  • So let's say that we put in a double you into a hashing function.

  • Well, then get out a number or another letter, something which, if we then put that number into the Al Gore the hashing function, we will get out the right letter.

  • So that means that what we will store in the daughter base will be a hashed AP ikey.

  • So that's gonna be a lot of like difference.

  • It's gonna be something different than the actual AP I came, But when we put in the a p i ke, we will get back or okay, trying to explain this in the right way.

  • So what will store in the database will be this thing.

  • And when we give the AP ikey, we will essentially perform the hashing function, and then we'll check whether our results match they already saved hashed a p i ke.

  • And if it does, then we will authorize the user and then, uh, get put into or then we'll get all the daughter that we want for that user.

  • Now, I'm not sure exactly what type of hashing function we're gonna use, and I'm not sure that I can actually share the ashen function.

  • No, I've I know, like you probably see now I know a little bit about how it works, but I don't.

  • I'm not an expert, like I said, and, uh, so therefore, I don't know quite all the details of it, but I think that's something that I can probably share the build out off that hashing function.

  • And then I can probably change it to a different type of hashing function afterwards, so that you get to see me building that out, and then I will just change it so that a ll the use of data is not just exposed or easily hackable, but that could also be something that's automatically taken care of by the hashing function.

  • So much work.

  • All right.

  • Okay, so there we go.

  • We have this now, which is I d a p i ke.

  • All right.

  • It's okay.

  • So there we go.

  • We have that one up.

  • Um, I think we've I'm not sure how long we've been actually streaming for right now, because I'm not sure I don't want to keep it too long.

  • And I feel like this 1 may not be the most entertaining one toe watch.

  • I think the next one, the next dream is probably going to be a little bit more entertaining because that's when we're gonna Now, I've just like this entire stream is pretty much gone towards figuring out how to set everything of this stuff up so that we have the server up and running and have, um, a p I somewhat working.

  • But next time, I think we will.

  • Next time is when we're actually going to get into, like, all of this stuff, creating the new daughter base tables for the tasks and creating the tables for the projects and a ll the other classes that we got here.

  • Um, all right, because I don't want to start anything as well at this time and then realize that it's gonna take me an hour to finish, So we'll see.

  • I'm just gonna try, Okay?

  • We'll look at the tutorial again.

  • See?

  • Kind of where we were asked.

  • Right here.

  • We have four months.

  • Three plastic are okay.

  • We've also to find Carlos.

  • I do.

  • Okay, so click ERT 56 so that ah, primary key is unique by default.

  • I I've heard I I would say that I knew this.

  • I'm not sure, but I knew this, but it's like I think the reason that I set this to be unique I think there was a specific reason when I built this out.

  • Didn't the primary Kay didn't become unique or something.

  • I remember, like having to actually look up how to make that unique.

  • So I'm not sure whether that is something that we actually need to add.

  • Uh, but I know I did add it for some reason, so I'm not sure I'm not sure that I want to remove it yet.

  • Okay.

  • What we're gonna do now is we're just gonna, uh this to get up again so that we keep our project progress.

  • Um, okay, kids.

  • Okay.

  • How do we add stuff to get in your file on holders two gets ignore.

  • Okay.

  • Uh, let's everyone to add a fire call, then.

  • We just need to write, read, made up to 60 and get in your file.

  • Okay?

  • Can we just creates a guest?

  • Ignore file it?

  • Let's try to create that.

  • I'm going to continue.

  • Um, okay.

  • Said that there's something that we can do.

  • We do touch such dot kit code thought kids on DDE.

  • What do we do then?

  • Save those files.

  • Us.

  • All right.

  • I think what we need to do then, as we need to dio on DDE back end and then slash and then and right, save it and then do get starters kit.

  • Okay, let's see if it's been added.

  • Mortals probably should at this as well.

  • Back and save it on, then.

  • D'oh!

  • Get kid.

  • Okay, Undo gift.

  • All right, so now that's gone as well.

  • Okay, now we can add it.

  • Uh, back and into operation started all rights.

  • Now we pushed that to gets hubba as well on.

  • Now you got to see how to do the get ignore file.

  • And you got to learn that with me if you didn't know it already.

  • Um, as you see, like most things are pretty simple once you just google them.

  • But the difficult thing I think with programming is probably Maur It's not necessarily doing the things that you need to.

  • D'oh!

  • It's more about, like, knowing what to go rules and knowing.

  • Ah, what you need What you kind of what you need to be doing.

  • For instance, I knew that you could just add something to get ignore file.

  • And that is kind of the more o'er the difficult thing about programming.

  • All right, I think that's gonna be it for today.

  • And next time we're going to go into actually making this, uh, making some end points here like tasks and basically that should then return a list of tasks for a different use.

  • Sir, we're gonna create an AP i ke.

  • Um, And then once we've done a few of the endpoints, we're also going to finish the daughter base or the tables for the SQL database so that we have all that set up, and then we're going to try to figure out a way to get all of the stuff from these end points.

  • We're gonna try out some get requests and push request, or some get requests and put requests, um, post requests and didn't delete requests.

  • Um, and then probably not next time, but the hopefully the time after that, we're going to get actually the app thio add stuff to the daughter base and then delete stuff from the database and get stuff from the daughter base as well.

  • Um, so that's gonna be pretty exciting.

  • I hope you enjoyed this stream as well.

  • Andi, I hope you enjoyed the video in case you're watching on YouTube.

  • And, uh, yeah, that's it for this one.

All right.

字幕與單字

單字即點即查 點擊單字可以查詢單字解釋

A2 初級

從零開始構建一個應用程序。用Python構建一個REST API | #4 (Building An App From Scratch: Building a REST API with Python | #4)

  • 3 0
    林宜悉 發佈於 2021 年 01 月 14 日
影片單字