Up and Running with Git Transcripts
Chapter: Teamwork: Merging
Lecture: Adding a feature: The Mac developer
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
Meanwhile, some time has passed. We're over here on our main machine on Mac and we know our other developer is
0:09
over there working away but here we are and we don't necessarily know exactly what they're working on. We've been given a task,
0:16
our job is to say, you know what web designers can't do anything with in
0:21
line HTML like this. Could we please please please create some CSS and create a template file. Sure thing. Let's do that.
0:30
So I'm gonna come over here and I'm going to create a directory called static and inside static. We're gonna have a CSS and we're gonna come over here.
0:41
I'm gonna create a directory called templates. And in PyCharm and we get a added benefit.
0:48
If we mark the directory as the template folder and it says we have no idea of any server side dynamic language you'd like to use.
0:57
Would you like to choose 1? Oh yes, please. We would like to do Jinja2 because that's what flask
1:02
does that will turn on auto complete and code checking and highlighting all that for our templates. Super important. So let's just call this,
1:10
come over here. We'll add a new HTML file. I'm gonna call it joke. Do we want to add it do we want to do a git add on this?
1:19
Sure. Let's do it notice the color has changed as you would expect. This will be funny web. And let's just put an H1 down here.
1:29
Funny web and in this section we'll have the joke. Let's put a div. Maybe we'll have the joke and we'll put this inside of
1:39
a strong, something like that. And let's put a div down here and then in here we'll just put our joke
1:46
for a moment and let's say we're gonna just put this over like this and we'll just say joke text. This is how you do this in Jinja.
1:57
I'm gonna pass this data over, it's called joke text. This will render it as some sort of text here. So great. How do we use this?
2:05
We go back here, we can go over here and say instead of doing this we're going to say return flask.render template and what does it take?
2:18
It takes the template name and it's going to be a joke check out how awesome PyCharm is. I love it so much.
2:25
I told you if we highlighted that directory as a template thing, it would do. Cool stuff. Look it auto completes here and over inside of a joke text.
2:36
It's gonna be just joke like that. So here we go again. We now also have this little H that bounces us
2:42
over and this H will bounce us back to the view method. Now again, all sorts of good stuff because we associated these templates here.
2:51
Okay, let's run it and just make sure things are working well to be honest I'm not sure that this is better but funny web,
2:58
the joke, How do you get code from a bank vault? You check out their branch. Yes, you do. So this is great.
3:05
It's, you know, not incredibly beautiful or anything, but you can see that our change we're trying to apply to it absolutely has taken
3:14
hold. So we're good to go. That's nice. Now I'm going to commit this locally but not synchronize it back to
3:21
the server, I'll say added HTML template for joke view, commit, not commit and push remember where trying to do things in parallel here just
3:36
to simulate 2 people who actually would be working in parallel. Okay, so as far as I'm concerned this is all checked in and it's saved
3:43
but again, just locally here, it's not synchronized back to the server.