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