#100DaysOfWeb in Python Transcripts
Chapter: Days 29-32: Static Sites
Lecture: Setting up and deploying to Netlify
0:00 Alrighty, now that you have your code all sorted
0:03 go ahead and push that to your github repo of choice
0:07 the one we set up before.
0:08 I've pushed it to my 100 days web-site repo
0:13 and you can see that here.
0:15 Next up, I'd like you to head to netlify.com
0:19 so www.netlify.com.
0:21 This website is actually a platform that allows you
0:24 to deploy your static sites.
0:27 So right now, we've been playing with our static site
0:30 locally, right, but we want it out on the internet.
0:33 So while the files are hosted on github
0:36 where can we get this hosted so that it actually appears
0:40 on the internet with its our URL?
0:42 Enter Netlify. Really simple.
0:45 You'll see that in just a minute.
0:47 What I'd like you to do is sign up.
0:49 Go through the sign-up process.
0:51 I'm simply clicking on login and logging in
0:53 with my github account. Once you are logged in
0:58 you will be asked to essentially connect Netlify
1:02 with your github account.
1:04 And what Netlify will do, is it will talk
1:07 to your github repo, so that's the repo
1:10 that our static site is stored in
1:12 and it will take that, it will process Pelican
1:16 our static site generator
1:17 and it will then populate our website onto the internet.
1:22 Okay. First things first, let's create a new site.
1:27 So it wants to connect to which git provider
1:30 so in our case we're using github, so we'll click on that.
1:35 It will then ask you a series of authorization questions:
1:39 do you want to authorize Netlify
1:41 to talk to your github account?
1:43 Say yes. Go through that.
1:46 Scroll down here, it wants us to choose a repository.
1:49 Now, my one only had one repository
1:52 so I kind of only had one choice here.
1:54 But you go through and choose whatever repository
1:59 had your 100 days website in it.
2:03 So you go ahead and select that.
2:06 Click on that and once you have the repo selected
2:11 you will then have some build settings here.
2:14 Now, I am going to deploy to our branch of master
2:19 but that's the only branch I have, so I had no choice.
2:23 Basic build settings.
2:24 Now, if you think back to when we launched our website
2:27 when we used Pelican to generate our website, I should say
2:31 we ran the Pelican content command.
2:34 Now, we are not going to run that every time
2:37 on a live setup, on a production setup.
2:40 We can run it on our local setup
2:42 but we don't want to have to run that on the web.
2:45 This site, Netlify, this tool will actually take care
2:48 of that for us, so we want to tell it
2:50 what that build command is.
2:52 And the build command is Pelican content.
2:56 Now, content is the folder, remember that.
3:00 So this is all relative to our repo.
3:06 Now, if our repo started with a folder here
3:10 in the parent folder, and then content was
3:13 one hierarchical directory below
3:17 we would have to specify that here.
3:19 So you might say, folder then content, okay?
3:23 But in our instance, content is actually
3:27 in the parent directory
3:28 so we can just write Pelican content.
3:31 Now the published directory is where we are going to
3:35 actually store the files once they're generated.
3:37 So again, Pelican generates the static files, the md files
3:43 converts them to html and puts them in our output folder.
3:47 So we need to specify that here output.
3:51 Just click on Show Advanced; there's nothing here for us.
3:54 We can click on deploy site.
3:59 And that will bring you to a page that looks something
4:01 similar like this.
4:02 You will first see a line here
4:04 mine actually went really quickly
4:06 but you will see a line here that says
4:08 this site is deploying
4:10 and if everything was done correctly, as we have
4:14 you should actually see this go green
4:16 and you will get this URL here.
4:17 That's your actual website.
4:20 And you'll see that the site was successfully published.
4:24 This is literally how quickly this things works
4:27 and how easy it was to deploy this onto the internet.
4:31 So I've right-clicked, opened our URL into a new tab
4:35 and we have here our Pelican website. Check that out!
4:40 Everything we did locally has just suddenly been deployed
4:43 on the internet, you can share the URL with your friends
4:46 and there's your website, nice and live.
4:49 So, now you can see, as we make changes
4:55 to our github repo here, it will automatically be picked up
4:59 and deployed by Netlify
5:02 and changes pushed to this website here.
5:05 And we'll do that in the next video
5:06 but it's pretty awesome, so stay tuned.