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