>> Cool. So you're doing it with me, right. >> What?
>> INSTRUCTOR: You're doing it too with me? The whole thing.
>> Okay. Let's do this >> INSTRUCTOR: Let's do this. We're going
to do a new one though. We'll do a new one. Or not. You want to use that one.
>> Hmm? >> INSTRUCTOR: You want to use that one.
>> Doesn't matter >> INSTRUCTOR: Do I have it on here.
>> You have >> INSTRUCTOR: I was just going to make a new one.
>> Let's do that >> INSTRUCTOR: Okay. So all you need is a
terminal right now. Okay? ready. Okay.
>> I'm going to record it as well so I also have it?
>> INSTRUCTOR: Okay. Cool. Okay. So we need a virtual environment. Cool.
>> Hi y'all (indiscernible) is this the last >> INSTRUCTOR: Probably not. Probably the
last one before graduation. No, no, we have one next week.
>> Okay. >> Okay. Cool. Okay. We need a virtual environment.
Otherwise we can't have Django. Okay? Hold on. First activate it. You have to activate
it first. Yeah. >> Ah.
>> INSTRUCTOR: Okay. Okay, cool. >> Okay. have that here?
>> INSTRUCTOR: Mm hmm. >> You need your charger?
>> INSTRUCTOR: I always get it out and don't plug it in. All right.
Okay. So we just did that, but because we want the
post guess database stuff too, so we're also going to do because that's going to give us
the database stuff.
>> Like that? >> INSTRUCTOR: Yep. Oh, yeah. It's like this.
You have a dash after install. It should be after Django.
>> Okay. >> INSTRUCTOR: You need this right here. And
it's to a belt. Yeah, there you go. >> (indiscernible)
>> INSTRUCTOR: I don't know what that is. Okay, go ahead. All right, great. That's going
to give us the database, the post gress database stuff we need. Cool.
So then we've got all our tools. I'm going to do this. Because it's just going to save,
like, what our >> Requirements?
>> INSTRUCTOR: Yeah. So what that means is that if I was just typing pip freeze. That's
a command that is showing me what all the stuff that's installed is. So it's saying
you know when I do it like that, yeah, you're good. If I just typed pip freeze it would
be like you have Django installed. You have the tool belt you have that stuff. But, if
you want to save that list in bash, if you want to save some output to a text file, you
say, like, put it in this file. Like that. That's what that is, okay?
so now if I look there, I'll see it there, right? So that stuff is saved, right? So,
if somebody else was to get that code or later if I had to delete my virtual environment
or something but I kept this, it would be very easy for me to so for example,, like,
if I got rid of my virtual environment, right, it's gone. And I'm like damn, I forgot what
was it that I had installed, it would be very easy for me to do this. So it looks in there
and it just installs everything that's on that list. So that's what that's for.
>> Wait, basically tells you both the program you have installed with this software for
this application. >> Oops, forgot to activate this. Yeah, exactly.
>> So wait, explain that again. If you build your virtual environment
>> INSTRUCTOR: Yeah, sometimes there's like a lot of files, right, you don't necessarily
have to pass it around on GitHub or stuff like that. But on this little text file, it
tells you need in, this, this, and this, right? And if you store it in a file, it's very easy
to so then when I start a fresh virtual environment, like, nothing is installed on this right now,
right. It's just blank. But, if I want to, like, restore it, it will just go through
the list and make sure everything is installed. You know? And so, if you're, like if someone
else in your team yeah >> Oh, so if I'm working on your application,
in order for me to be able to then know all the things you need for that application
>> INSTRUCTOR: Yeah, exactly. So you can run what I run, you know what I mean? So for,
like, with group work it's good. Because the text file is a little tiny thing that you
can actually push and pull and it's not a problem. So when you pull it down, first you
can do is pick install flag requirements and it will make your computer my computer so
it's good for collaborative. This has almost nothing. Just database and basic Django. But
it's a good thing to do that. >> So let's say if you need for example side
port 2 or blah, blah >> INSTRUCTOR: Exactly. It does it all at
once, right? Okay. So our tool, our environment is now totally set up. We can start working
on the actual thing. So we're going to go Django admin, FEY. Start project. What should
we call it? I'm going to call mine adding data app. Boring. Okay.
>> I'll go with that. Okay. >> INSTRUCTOR: Okay?
cool. So that's the project. Which means, like, that's where to go. Now we've got to
actually make the app. That was start project. Now we're going to do start app. So I need
to go inside that. And once I can see I'm in the same place as manage PY, then I can
say same thing not project but app this time. >> When do you do that ? Like, I noticed you
did you have this thing background and you created something that space and is that where
we're doing that now? >> INSTRUCTOR: It is. Yeah. So every Django
application really Django has projects. And inside the project is an app. So, like, Google
is the project. Maps is one of their apps. Calendar is one of their apps. It's always
drawing on the same creepy big set of data. It's all still Google but the app it has multiple
different apps inside it. Gmail, calendar, all that stuff, right.
>> (indiscernible) as same as like calling Google and making another Google
>> INSTRUCTOR: And that's fine. That's fine. >> Is that what we're doing
>> INSTRUCTOR: I always do that just to help keep my brain straight. I make the outside
folder and the project folder the same and I call the first app app. That's just so I
can keep in my brain which is which. People do it differently. So up here we did start
project to make the bigger project. Now we go inside the project and say okay, we're
going to make an app. So Django admin.py start app.
>> INSTRUCTOR: Yep. You need this to be bigger? Do you want me to make this bigger? The text.
>> If you could, that would be cool. >> Yeah. Probably better for the recording,
too, yeah? Okay. Cool. So now I can see that I have this additional
folder here in the app. So, if I was to be, like, oops, sorry, I have another one open.
Woo, it's running. Okay. >> Yay!
Okay. >> So it's running and it's saying there is
nothing here. Right? Okay. So now I have to tell it what should come
up when it first comes up. So let's do that. So what we're going to do is Okay. So every
project, every project has a URL file if they type in this, go here. And every app has a
URLs file, too, that says if they type in this, go here.
>> Say that again? >> INSTRUCTOR: Yeah, so you know we were working
in URLs. It says when the URL says this, go to here. Before that it was something something
slash app before. >> Yeah.
>> It can also be slash admin. So that first thing is the name of the app. So actually,
we have to there's always a URLs file inside this one for the project. See how there's
two sometimes? So, like, here so there was one here. Right? But there's also one here. The reason for that is this
one that's in WISC onda, all that's saying is that's the first step, okay?
So it's kind of like if I walked over 1744 Columbia road. This building, then I'm like
yo, where's code for progress. They'd be like go to the third floor and ask whoever you're
looking for. I was like yeah, I want to buy a bustiere. Then go to the second floor and
ask for your thing. So in this case I'm looking for the project and I'm like yeah yeah yeah,
I'm looking for the app and it would be like oh, okay, cool. You need to go there. It has
its own set of directions, okay? So for the project we'll always make a URLs
file that has one line for every app. That's it. Okay? So admin comes with Django. And
app is the one that we're writing, okay? All that is doing is telling it okay, once
you get here, you want app? Okay, great. Go get this file. Yes.
>> The name URL and then another URL or inside. >> Directory, subdirectory. Yep. Yep.
>> Can you show me both? >> INSTRUCTOR: Yeah. Okay. So this is the
one that's saying you know like the URL, it's it gets this far. And if I typed admin, it
would go to that admin whatever. If I typed app right now it says that doesn't exist yet,
right? Because we haven't made it. Because this is ours. Now if I went over and did that.
So this is saying when they type in admin go run the admin function. The reason they
gave an error is we don't have a database yet. Okay. So here Okay?
>> Can you whatever it is that I'm taking here, go to this other URL
>> INSTRUCTOR: Yeah. Exactly. So it's saying okay, once you've matched this part remember
in the other one we were saying when you match this, the thing after the comma says now go
do this. Right? So in this case it's saying you got this far? Cool. Now go to this file.
So so far I was getting this and app, what's app? I've never seen that. All it has is a
line for admin. It doesn't match anything. But now when I do that it's going to go cool.
Okay, I found app but now there's nothing else. It's telling me to go get it's saying
go here. But that doesn't exist yet. Because we have to make it. Okay?
but I'm thinking that's like this. Then when you go to Facebook.com, and it tells you home
and then from home you can go to, like, friend >> INSTRUCTOR: Exactly.
>> But what the apps okay. so this would be the main one. Right? It should be the Wisconda.
>> INSTRUCTOR: Sure. >> So that would be that one. That app one.
>> And then (end clip)
And it tells you home and then from home you can go to, like, front.
>> INSTRUCTOR: Exactly. >> But with app Okay. So this would be the main one, right? It should be the so that
would be that one? That app one. >> So then whenever I have that it's going
to take you to something else. >> Exactly, right. So all this stuff means
before it is Wisconda/app/and all this stuff yep. Cool. Make sense? All right, cool.
>> Why don't we have it because it's within Wisconda. So Wisconda/App will take you to
the main page. If you have anything after app it will take you to this other page.
>> Right. Got it. Okay. So now it's saying yeah, you said to go get
app.URLs but it doesn't exist. Cool because we have to make it right because it doesn't
exist right off the bat so let's oops, sorry, let's create it. Because you see right here
there isn't one yet. I think there should be. In my opinion but whatever. We'll make
one. So we don't need all this shit. Okay. >> How do we get there?
>> INSTRUCTOR: I made it. Okay. So where do I have to make this.
>> Mm hmm, yeah. So this we think about it here it says go to app.URLs. What that means
is app.URLs so it needs to be inside the app folder.
>> Okay. >> Oops sorry.
>> We have app folder but we don't have the other folder?
>> INSTRUCTOR: Open that. >> Ah, oh. I see. I see. Okay.
Okay. So I need to type down what you just typed
down and then save it into URLs. Is there a space?
>> INSTRUCTOR: It doesn't matter. Oh, yeah. Nope. Nope.
Okay. And once I save it.
>> One more thing save as. Into my app folder.
>> Yep, right. >>
>> INSTRUCTOR: So what we basically did is say whenever if they've gotten something something
app/about, something should come up, right? So this is the URL for if we were doing this.
And so it's like cool, okay. I found it. Still, if we have this, it has nothing there, right?
Because we have not created the view yet. So what it's saying here is yeah, yeah, I
got it. I got this far, so this showing, like, what the program did, right? It went through
here, ah got it. And wind through here and says what views.about. I don't know what that
is. So it's saying that because right now if we go into app dot views, there's no about.
Right? So we need to make one. >> This is essentially what is happening to
make sure I understand, what it's doing is when I click to the about when I go app/about,
it's basically saying, importing from the views. So now it goes to my apps and it's
going to go to my views which is here. Right? >> INSTRUCTOR: Yes.
>> And then that's what's happening so that's whenever I go to the side. And then I go app,
about, so that >> INSTRUCTOR: Reload it so did you do this
yet? We did that one in the app folder. Did you do this one in the
>> We did this one. There's another one this is the one in here. So you just did this one.
But this one here we have to do that as well. You want to open that one? So there's a URLs
file in app and there's another one here, right? So we just did the one that's in app
but I don't know if you did this one yet. >> INSTRUCTOR: It already exists. You just
have to open it. Back to here, yeah. URL. >> INSTRUCTOR: Mm hmm, yeah, there you go.
You just have to add this line right here, just that.
>> Okay. >> INSTRUCTOR: Sorry, this is kind of hard
to see. One second. This is it here. Cool, one thing. There you go. Great. Cool.
So go back to your browser. Reload it. So we fixed that. Now it's saying I don't see
so I did all this and it went to that file that you just typed and then to the next one
and now it's trying to go to views and find the about function. We don't have one.
Right? So I need to say Okay. What do I want it to do when I get here. Okay. .
>> Views with the app folder. How do I know which folder to decide on the
app for the app folder? How do I know which one is which? What do I use?
>> INSTRUCTOR: Yeah. So really, the only file that happens in both places the only 1 that's
in both place asks URLs, everything views that's only ever in the app settings is only
ever in the other one. So in this case you just go look. So there's no views file in
here. >> But am I going to put all the files in?
Does that make sense. >> Most of them you don't have to you're going
to put almost so you'll never be creating a file for this. For adding data. In here,
all the files that need to be in there are already there. Okay? If you ever add a new
file or a new folder, it's going to be in here because here is where we're going to
make, like, templates, you know? We're going to make static that's all in here. And here's
where we made URLs. Where we would make, like, forms, all that stuff. You'll never be adding
a new file to this one. Only to this one. Okay?
Got it? >> INSTRUCTOR: Yep. So basically, what happened
was the program went to here and it found app and then it followed this instruction
and said Okay. Go to app URL and it did that and then it was like about cool and goes over
here and I'm supposed to go to views, got it and find about. Okay. Views. Yep.
>> Views. There's something that I want to see. So this is something that I'm going to
display. >> INSTRUCTOR: It actually means go to this
file. It means go to views. Yeah. It means go find the views file and inside
there find it's about tool. So views is just a toolbox. Right? So when it says from app
import views, it means from this app folder, import the views file. Okay? And so then it's
going in here. And it's going to look for Okay. Where is about.
>> Is that the function about? >> INSTRUCTOR: Yes. It's just going and looking
for a set of instructions. So would >> Where do you get this from? Any brain.
>> You just did it. >> INSTRUCTOR: Hold on. This thing always
closes because it's top screen. See? Okay. >> It's a touch screen?
>> INSTRUCTOR: Mine is a touch screen. It's not a good thing. It's not a good thing. It's
not a good thing because you just closed my views file because you were like what about
this? That's why I'm saying it's not a good thing when you're teaching or like with my
nephews they'll be like dong dong dong and everything is closed. Yeah.
>> It does that. Like number 2 you just right now, right? Yeah. And you don't even need
it if you're not going to use something like this. If I'm only ever going to render a template
if I was doing this instead. >> When do you use it?
>> INSTRUCTOR: Never. You use it when you want to re when you want it to go somewhere
else besides an HTML file. I was just doing it because I wanted to say hello on the screen.
>> Like where else would it go? >> INSTRUCTOR: To another function or if you
just wanted to spit out, like, an like you just want it to say some text.
>> Never mind. That will be something that I won't so, if I was going to do that, you
know, it would work, right? But I can't use render. That's not going to work because maybe
it is going to work. Shit, whatever. >> Okay.
>> if you don't need it because so you still put that on the line?
>> INSTRUCTOR: I thought I did need it but I don't.
>> Okay. >> INSTRUCTOR: I think. Because I thought
that I couldn't do this but I guess I can. >> Okay. Yeah, see? Yeah. It wants HTML. Yeah,
it wants HTML. >> Okay. So http?
>> INSTRUCTOR: We can skip it too but we have to make a template. You want to skip it. Let's
skip. Or you want to do you want to do it? Tonight? Yeah. Rachel is coming in. Cool,
let's do it. Ready? Okay. . >> Awesome. So now, okay. Now, we're going
to do this. Okay. Let's make it work. We don't have an index page. Let's do it. Ready? We're
going to do two things to make that work. >> You've got to make an HTML page?
>> INSTRUCTOR: Not necessarily. In this case we don't have HTML, right.
>> We've got to create I know. >> INSTRUCTOR: Go for it. Go for it.
>> And you were when we have index, it goes to the views page.
>> INSTRUCTOR: Yes. >> Right?
>> INSTRUCTOR: Go for it. >> So that would be go to my views page and
then it goes I'm going to ah. No, wait, wait, wait. Okay.
Yes. No. >> Yes.
Bam. Okay. Good.
So that's how it gets around, like that's the path how it gets to stuff. We still haven't
added a database or anything. Which is fine. With the API apps, you never even use a base
but database but this is how it's gluing all its shit together. We could also do stuff
like this. So the idea is that when we go to a certain page, it goes and it does everything
it's supposed to do and then returns. It's a function, right.
Okay so in some cases >> So this is where we restart the database.
So you want to make a database. >> So I have to get out of here, right? Do
I just create a new terminal? >> INSTRUCTOR: Yeah, I just make a new terminal.
>> We have to go into that folder. >> Hmm mm. Just start it.
>> Okay. >> Yeah, you can do that. Totally, you can
do that. That will work.
>> When do we do this? >> INSTRUCTOR: I teach people that so that
they know what's happening because if you're used 0 only doing this, like you never go
into the SQL terminal and you're like whoa, when you do have to go in, it freaks people
out so that's why I teach people that. Also in post guess this works. But, if you're using
my sql, mongolett, you have to go my sql and do the statements there. So yeah.
Makes sense. >> INSTRUCTOR: Whatever you want.
>> And yeah, that's the other reason. Because you're logging is post gress. Because the
user for post gre is not miella it's postgres, we were doing this stuff, right?
>> So I have to do this the pseudo view. Okay.
>> INSTRUCTOR: Now you can create a database. >> Hmm.
You need a semicolon. >> Oh.
Oh, yeah. So, if you're inside postgres, it's going to be Okay. Great, cool. Now we get
out of there. >> So now we have to go to sql.
>> You're in SQL now and we can get out. >> CTRL C?
>> INSTRUCTOR: Here. Okay. Cool. So our database is created and now we have to go and make
a model. So and so we need to adjust our settings to connect to that database and then we've
got to, like, make some sort of model that actually exists in in it. So Okay. Two things
we're going to do. One is settings. And the other thing is going to be models. Right?
So I never remember the syntax for this and I always go get it from something else. So
we have to open the settings from the big app.
>> INSTRUCTOR: Yes. >> So let me write that down.
>> Mm hmm. >> Why does it change in the big application
but not in the actual app because it is when I think on Google I always think of Google
as being this huge database every time it creation a map. Why are we changing it into
settings as a big application in a small app? That make sense?
>> INSTRUCTOR: So actually, the question you asked is the reason why we're doing that.
You said, like, Google has one big database, right.
>> It does. >> I mean, it has many but, like, it's yeah,
no. Actually pretty much it creates a data service. Right? Because think about it. Like,
so creepy but, like, you know, if I'm doing this, and I type in look what comes up.
>> Technically, we are oh, wait. Why are we still with the big cases? Are you with one
application. What if I wanted to create multiple application but with different
>> INSTRUCTOR: Databases. >> Yeah.
>> Why are we working with the setting in the big database?
>> INSTRUCTOR: Because usually when you do a project and you have multiple apps inside
it, they're all pulling on the same database. >> Always.
>> INSTRUCTOR: For that kind of Django set up, yeah. You can do stuff to make it connect
to a different one but usually it's connecting to one but there will be, like, different
tables. >> And then model an app.
>> That makes sense. So settings change for the big application but the model change for
the little application? >> INSTRUCTOR: Yeah.
Right. >> Okay.
>> INSTRUCTOR: Okay. So let's do >> Let me open my files. Okay. So models.
And then my settings. Okay. >> INSTRUCTOR: I'm okay. so you know what?
I'm going to say >> Powerful woman.
>> Okay. . >> See models in my model. How do we choose
how many characters to nick our model for example, I'm thinking like when we like the
the dump you sent me yesterday was a small character field. How do I decide if I want
somebody to do an application? Is there a limit to how many characters can be in my
models? >> INSTRUCTOR: If I want to do an essay, you
know what I do? Okay. Like this, right? One second.
One second here. I don't think I have a text field down here.
But yeah. I was just trying to remember if I had to
do those are not. I think so. Okay.
>> I think I'm good with that? >> INSTRUCTOR: Okay. Cool, awesome. So we're
doing that. All right. So we did our models, now we have to do our settings. Another thing
we have to do in settings, any time we add an app, yeah.
So we always have to do this by the way. >> You what?
>> INSTRUCTOR: Any time we add an app, we have to add its name to this list right here.
So we'll do that while we're in here. >> So Google, Google Maps, Google travel,
blah, blah, blah, I have to list all those applications because this is a big database.
Oh, that makes so much sense. >> INSTRUCTOR: Linking everybody together,
yep. >> And then I have to change this. To I have
to put all this stuff in here. With my stuff.
>> INSTRUCTOR: Yeah. >> In user is this correct?
>> INSTRUCTOR: Yeah, but you got to put quotes. >> Which one? And then I have to change this.
No? >> INSTRUCTOR: Yep, you do. Change this to
seconds. Stress. Why am I typing sites? >> INSTRUCTOR: That's the same of the Django
module when we installed Django tool bet belt, that's the name of the Django package that
connects to post risks. >> Okay. So it should be good to go.
>> INSTRUCTOR: One more. Name. Okay. So whenever I have more than one multiple,
when I have multiple databases, I will just type this in.
>> INSTRUCTOR: Yeah, it would be like this. You would do stuff like that. Okay.
You have to fix one thing. >> Say that again. Okay. Cool great. So now
all right we did this, we did this. We have to do something to yeah, exactly. You remember
how to do it. >> Find someone on the shell?
>> INSTRUCTOR: Close, very close. >> Big one and
>> INSTRUCTOR: Basically, I just want to be in the same as that.
>> Within the big app or the app? >> INSTRUCTOR: Within the outside both of
them. I want to be in the place where manage.py is.
>> Is it in only one place? >> INSTRUCTOR: Yep.
>> Okay. Let me get there. One second. >> That's the big boss.
>> Say that again? >> INSTRUCTOR: That's like the big boss. That's
the big boss application, it's the thing that does the really serious shit.
>> I'm here already. >> Mm hmm.
>> So adding data. What is it? Items, manage. >> Ready?
Manage.py, remember what it is. >> Did I do it didn't do anything. It didn't
hurt anything. Manage >> Not shell. If you do shell, this is going
to happen. Hold on. >> Got it. Yeah, status.
>> Is that valid syntax? >> INSTRUCTOR: Oh. Yeah. It's saying that
there's an error in your models. >> Comma.
>> INSTRUCTOR: I probably have the same error, one second. Okay. So for you
>> Where are you getting that? >> INSTRUCTOR: Line 3 at the end of the line.
>> Colon. >> INSTRUCTOR: Yep! Model 3.
This is capitalization. >> Capital F.
>> INSTRUCTOR: Getting good! (Laughter).
Yeah. You have all kinds of useless shit in your head like me now. Capital F. Capital
F. You know what? It's going to your brain will get full of shit that's useless. You
want to know the what password for Dirk server is F6 capital H2B, why is that in my head?
I don't know. The password is like this, unfortunately it's it's tattooed on my brain along with
your other 12 passwords but anyway. Okay. Cool. So let's try it again.
>> I've never seen that before. Let's go back to the models file. This. Right here.
Now I have to go to my yes. >> Can we do it all three ways.
>> Sure. We're going to start with this one. How do we get to the admin interface, remember?
We'll go to there. How do we get to the admin.
>> Admin is another app that it has. Yeah. It's its own app so not our app. Just like
that. Are you running. >> Am I running the yep.
>> What am I >> INSTRUCTOR: Server.
>> Icon. Server. Python manage.py run server. Okay. Okay.
>> Is it a password that I use? >> INSTRUCTOR: Mm hmm. You want to reset it?
Do you need to reset it. >> You can reset it. Okay.
>> INSTRUCTOR: Cool. Like this. >> It was just three. It wasn't that
>> It was three. >> Is it capital P? Mine is popcorn 13.
Okay. >> I I had the same thing earlier. Wait. Oh,
no. I was going to say can we find it there but probably not. Never mind. Okay. So delete
your database and start again. So we'll do this. Ready.
>> Isn't there anyway to user name, how can I like.
>> like, I had to do this I had the same mistake this morning.
>> INSTRUCTOR: The problem is that it's a super user. So I mean, you can look it up
if you find it but Barnacle's out. How do I get out of here?
Yes! Okay. . >> It was a capital. Okay. I'm ready.
>> INSTRUCTOR: Okay. Cool. Yeah, sorry. Shit, damn it. Okay. So we should
see our models on here. We go to admin, right? So one thing we have to do is we so, if we
look in here, we can see hey, there I am. There's my user, right.
>> So we're adding that entry differently, aren't we.
>> The first first one is going to be through the admin.
>> Which is good to know because if you ever have to tell somebody else to do it like if
you make an app for someone who is not a coder, they'll use that. So that's not important.
So, like, right now on the admin interface, you can always see your groups and users but
notice where are our warriors. >> All of our models will show up here if
we want. That's how we manipulate our data. but something is missing, right? Where the
hell are they, right. >> Right?
>> INSTRUCTOR: Because we often have so many models that you don't want everything to show
up in there because sometimes it's stuff that, like, people can, like, fuck up the program
if they start messing with and you have to decide which things are changeable in the
database and we do it here. We go into app and we go into admin.
>> Okay. And then you see it says register your models
here. Hold on a second. See what the syntax is.
Yep. So what we have to do is admin site register
whatever the name of the model is. >> What does that mean?
>> INSTRUCTOR: That means when I put it here, see how right now what that's telling it isn't
yours what's yours called? What's your model called? Is yours called this.
>> Say that again. >> INSTRUCTOR: What's yours called.
>> Warriors. >> INSTRUCTOR: Is it.
>> Oh, crap. Hold on. >> INSTRUCTOR: Don't change that though, right?
So you want that to stay the same because that's now a match to the database. Yeah.
So then yep. So make sure that that's the same.
>> Got it. >> Is it underscore, right? Like a yeah.
What we're doing there is we're saying I want the admin site to actually show that. Okay?
So, if I save that, now when I go here, Okay. Reload it.
Oh, oops sorry, my bad. Okay. That's good.
I'm not signing it, correct? Okay. CTRL C. Exit is when you're in python.
>> Manage.pi and server, okay? Hmm let's go to your admin. Oh, go back. Move
line 2 over to here. See what you're doing, you're in models file and you're saying from
models import. Right now you typed it on to here. But what we actually need to do is we
need to type it on here. Line 2. Take it off of there because you don't have to import
it from it self. Yeah. >> Oh. Into my admin file.
>> Yes, that's right. Because if I want to say its name, I have to basically get to know
it first. So there you go. Okay.
Cool. Okay. So now let's add one. I'm going to add one. Me too, I unchecked real life
because she's not real life she's not real life. She's fake.
>> How come you have it as effect? >> INSTRUCTOR: Probably because in mine
>> Oh. Okay. Good. Great. We done? Okay. I added mine. So here
we go. Okay.
Okay. Cool. So she's there. So now it's in the database.
We can you know, we could go look at it in here if we wanted to but now we're also going
to go so whoops, hold on. Okay. So now let's do this.
>> We've added this through the admin interface, it's up
>> INSTRUCTOR: It's
in the database, yep. >> So, if they synced yep.
>> Yep if it's showing up in the admin interface, it means it's there. Because when you click
save, it's like commit. So now we're going to do it manually. So
>> Do I have to open up a new terminal. >> You can if you want to. Doesn't matter.
>> If I want to keep on from here, I can do that?
>> INSTRUCTOR: You can leave it, yeah. Mine is open here.
>> Okay. And then what do you do? Manage. So I
>> INSTRUCTOR: Mm hmm. Okay. Cool. So first thing we're going to do is from app import
oops sorry. From app.models >> so oh, my God, this is making so much sense.
>> INSTRUCTOR: Yep. Good. I think yours is called warriors. Isn't yours
called warriors. >> Yes. Warriors. Okay. Cool. So now I want
to see what's in there, right? Okay. So Okay. So let me see. I just want to see who is the
first one or let me see how many there are. One, so I could say cool, print out the first
one, that's kind of boring, what if I said print out the name, print out the bio. Oops.
>> pause. >> INSTRUCTOR: So what I've done is I went
and asked the database hey, what are all the warriors and it gives it back to me as a list.
It's a long list, right now it's only one in there. If I want to see the first element
of the list, I'm saying give me the first one. Warriors zero. And that's enough. So
I save her there. And if I want to see her name or I can say for warrior in warriors.
>> You don't actually show, shame on you. Oops, sorry.
>> INSTRUCTOR: So but let's slow down, let's go back.
>> How do you do in? >> INSTRUCTOR: It's fine. It's fine. This
thing doesn't respond to clicks, it okay. The terminal is like it can only do keyboard
so it's okay. >> When you type in warrior, where are you
getting warrior from. >> INSTRUCTOR: I can do whatever I want. I
can do like this for it's a for loop. >> But how are you getting you're typing warrior
but you have women warrior. >> INSTRUCTOR: Mm hmm. Because what I did
is I made a query to the database to go get all the list I stored it in a variable. I
can call that variable whatever I want but up here I called it warriors and up here I
called it my list of warriors. >> Oh,.
>> INSTRUCTOR: Yeah. So because of this. Right here.
>> Oh, so, if you have more than one woman so, if you have more than one woman and you
type down warrior oh. >> So let's put 1 in. Okay? Who is another
one. >> Does the station matter?
>> INSTRUCTOR: For here it does. Any time you want to say I want to use an object, then
yes, it does. >> They asked me my goals.
>> What did you interview. >> (indiscernible) .
>> What are your goals in five years. Did you practice that? Oh, good.
>> Yeah, I said actually, like I'm really interested in journalism and I always have
been and I would like to specifically issues. >> Capital D.
>> Color and, like . >> So then Okay.
>> Warriors. >> Cool. So now I still have to save it. So
I typed it in there but not until I press save is it going to go in so I'm going to
do this. >> Guys, one question, I'm recording Aliya
into video. So >> Sorry.
>> >> INSTRUCTOR: Okay. So I have to save it.
>> Okay. >> There you go. Cool. Okay.
So now if we go we ask that same question again to the database and I'm like hey, give
me all of them, So >> I have not done that.
>> That doesn't matter, it's okay, that doesn't matter, it's separate from adding and removing
and stuff. This is a database query, right.
>> Got it? >> INSTRUCTOR: Okay. So now do a space first,
space it over like here. Give it a space, it needs an indent. Yeah. Just one space is
fine. Just one space is fine.
>> There you go. Now you can do it. Okay? Do it one more time. Now if we go back in
here, we're going to see your server is not running. Cool, we've got her. Okay. So last
one. So I made something here it does one thing and it's a new one and it's called populate
a Django database from a csv. If you look in here, you'll see this here. So the idea
is if you just took this part >> Okay. Follow that.
>> INSTRUCTOR: No, don't worry about it. So I'm just saying it's there if you want to
go look at it. So let's actually make the csv first, right? So let's say who's another
>> Do you want me to follow this or >> INSTRUCTOR: It's up to you, if you want
to just watch, that's fine. So we need another hero.
>> INSTRUCTOR: I know and true life when she's younger and real life, yes, she's real. Cool.
>> Do you have to make the headers. >> INSTRUCTOR: I could. It doesn't matter.
If I do make the header, I have to tell the script there's headers in there. I don't feel
like writing this line of code right now so I'm just going to do this. One more. Okay.
So I need to I'm going to save this where that is.
>> Save it to your desktop. >> INSTRUCTOR: I'm going to save it in the
app folder. What is this called again? Okay. Cool. So I made that CSV and now if I want
to say this, this is a lot of shit, sorry. So I got to go find where did I put it. There
it is. Oops that's not the right thing at all. That is not a csv.
>> Oh, my God? >> INSTRUCTOR: That is a mess.
>> You have to make a CSV file? >> INSTRUCTOR: No, I can actually just do
this. >> Yep. Okay.
All right. So I'm saving this in the same place as that.
>> Explain that again. >> I decided to save the script I'm going
to use to, like, add it. I just wanted to put it in the same place as this. So that
it's easy to get to, basically, it just has to be inside the app somewhere insides the
app and it has no know where the CSV is because it's going to link to it.
>> Somewhere inside the big app, not little app?
>> INSTRUCTOR: It can be anywhere inside the big app. Even here would be fine. It just
has to know which app settings it's going to go get. Because what I'm going to do here
is I'm going to say right? And if it was in some other random folder it wouldn't know
that's why it has to be inside the apps folder somewhere.
>> Like ideally, inside next to. Next to it. >> Okay?
>> INSTRUCTOR: So next to it. How do I know that because it's saying from write app.models
write app dot models. If I had saved it out here, I would have had to write Okay?
If I'd saved it here. But, if it's right here, then it's right there. It's very accessible.
So this is just me being able to direct it like what's the path to go find it. Okay?
Okay. So now what did I call this? It was called warriors, right.
>> Uh huh? >> INSTRUCTOR: And I used commas to separate
and double quotes remember when I saved it said is this the correct setting and I said
yeah. Okay? So I didn't need any of this stuff, to be honest. So this is from another thing.
So the important thing to know here is what we did in here when we said equals blah, blah
like that. And then we said save. Really? This is what we need to do to set up how to
open the CSV, but honestly, this is basically what we're doing here. Same commands over
and over again. But I'm just going to call it this instead. And I'm going to say
>> You don't have to call it >> No, I can call it anything I want.
Okay? And then now instead of instead of me typing in you know the name and value every
time, I'm going to say where does it get it from the CSV. So in this case, where is the
name? Here. So it's going to be so for row and each line, name is in row 1.
Spaces don't matter but I always take them out. Bio equals row second row because it's
01, 2, like that. Basically it's making each row into a list so that's why I'm slicing
like that and then real life equals row 2. Okay? .
>> Yep. >> INSTRUCTOR: That should be it.
Okay. Try it? Go find it. So when I do this, it's going to give me an error and I'll tell
you why. That's it. That should be all I do. But I'm going to get a big error, ready? Ah!
So what this is saying >> Wait, pause, what was it you just put?
>> INSTRUCTOR: Just the same way you know how to run a python script. Boom, this is
it. The reason this is happening is if you want to Ryan run a python script from the
command line, you need to tell it which app settings you're talking about so all we're
going to do is this. We're going to say export. It tells you you can Google this thing if
you need to. This is something that I hope they fixed in the future. But it is the name
of the project, the big project, okay? That's something you might want to write down.
I would write that down. Because it's going to come up. It's just an annoying thing.
>> Okay. >> INSTRUCTOR: Okay. That's cool. Now I can
do it. Ah. Oh, okay. So I have an error. And that error is ready.
>> Nice job. >> INSTRUCTOR: Okay. Cool.
>> Feeling better. >> INSTRUCTOR: Good.
>> We have another one of these scheduled for tomorrow, right.
>> INSTRUCTOR: Yep. >> Okay. I think what I would like to do now
is can we have powerful warrior object, how can we change that to the name of every stone
woman that we sent. >> INSTRUCTOR: Yeah.
Pause it. >> INSTRUCTOR: No. So this is like the simple
thing, right? Sometimes it's better to see, like, wait that's a mess before you learn
what we do to fix it so you'll know why this thing is valuable. Right? So for example,
see how this happens. >> That's another thing I've been meaning
to ask about like that. What is that. >> That is what you just asked about. So if
I want it I could be like bio but that's going to be long. So I'm going to put name. So now,
see if that works. I don't know if I have to sync the database again or not.
>> That is so cool. >> So that's what that is. Now, if I wanted
to, I could be a big problem. So the reason this is unicode is
>> What does unicode mean? >> INSTRUCTOR: Exactly. So shit. I'm just
typing it here so it's notes for you. It just stays in the video, okay?
>> Yeah? >> INSTRUCTOR: Okay. So.
>> Got it. >> INSTRUCTOR: Okay?
>> Yes. Okay?
If I did it like that ah! Okay. So I want to go back and make it Okay. .
>> Yes. I feel like I should be scheduling more tutoring?
>> INSTRUCTOR: I don't know if it's going to happen before graduation because we're
so packed. But sure. Yep. Let's do it. When time is open.
>> What can we do for the next step for tomorrow. >> Probably the important part is, like, now
that we have data in the back and we have hello in the front, how do we get the data
onto the front. >> Yeah, so we'll do that tomorrow?
>> INSTRUCTOR: Okay. Cool. Cool bean.
>> INSTRUCTOR: And that's all all about views like this. Ready.
>> Yeah. >> This is for tomorrow?
>> INSTRUCTOR: Mm hmm, a preview of tomorrow. Okay.
See if it works. I know why, hold on.
>> So everything that we've worked on >> Everything. So now it's all about getting
all the stuff into the HTML. >> INSTRUCTOR: Yes. Yep.
>> Oh, my God, I should have scheduled this, like I just feel bad because we kept rescheduling
and rescheduling. It makes so much sense. It makes so much sense.
>> INSTRUCTOR: Let me give you this.