#100DaysOfWeb in Python Transcripts
Chapter: Days 29-32: Static Sites
Lecture: What exactly is a static site anyway?
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
I figured a good place to start would be to cover what a static site is what is a static website and what is a static website generator?
0:11
We'll start off by covering what a static website is and forgive me for showing you the PyBytes website. It is a shameless plug, but I'm proud of it
0:19
so you're going to have to look at it while I talk. A static website is PyBytes. That's a perfect example of what a static website is.
0:28
A static website is essentially a series of web pages with fixed content. It's static content. It's content that does not change
0:39
unless myself or Bob as the admins of the website go and make an intentional change. So, taking a look at PyBytes
0:47
if you would have browsed to PyBytes now I strongly recommend it, it's a great website you would have the same experience
0:55
browsing this website that I do. Clicking on the About page would bring up the exact same About page here. Same with clicking on Articles.
1:05
You would see all of our articles here. The entire website is static. It stays the same no matter what. You can't do anything to it.
1:14
I have to make a change for something to change on this website. Now you might wonder what's different compared to other websites.
1:22
Well, think about your favorite news website lik, you know, news.com or news.com.au. That's a dynamic website. There is a database in the back end.
1:32
There's all sorts of funky stuff going on and every time you go back to that page changes are happening. You're doing stuff to it. You can log in.
1:40
You can do all sorts of crazy things on these other websites. They're not static. It's not a simple as one of these websites.
1:48
That's why static websites are actually fantastic for blogs because blogs don't potentially change
1:54
other than the admin or the blogger creating an article and that's why we have static website for PyBytes. Now, what is a static website generator?
2:07
A static website generator is something that takes the back end code, so to speak takes some markdown content takes some schematics, if I might
2:20
and converts that to the HTML that renders in your browser. I figured the best way to show you this is to show you physically.
2:31
This here is the GitHub repo that houses all of the back end schematics or source files that make up PyBytes. If you look in our content folder
2:44
you will see every article that we've written on this website. There are code challenges, there are Twitter digests everything is here.
2:53
But notice it is the markdown format md. This is our source file. This allows us to do things like adding double hashes, like markdown format
3:06
so you can get headers and manually putting things like bold and italics. Now, you can't really see it here because GitHub is interpreting that
3:15
so we can edit this quickly and you can see here is more of what it actually looks like in the markdown format. So we've got the four tildes here
3:25
to allow for a code block, and so on. So this is a source file. This is obviously not what it's going to show up like on the website.
3:33
What happens is we use a static site generator called Pelican which is what we are actually going to use in this chapter
3:40
and we use Pelican to take this source file in these md files in our instance and we use it to convert these into HTML files. So it goes through.
3:54
Pelican converts these. It generates a website, which you can see here. Now, this is our output folder.
4:02
It takes everything that was in that content folder converts it to HTML. It literally generates our website. And in here, taking a look
4:13
let's choose one of our code challenges you can see everything is now HTML. It has converted everything from that markdown format
4:22
into a nice HTML page for us. And as you can see, it's all quite static. There's nothing special about it. This is raw HTML. Very similar to, you know
4:32
what you would have used back in the '90s or when you were first starting out learning HTML. And therein lies the beauty of static sites
4:40
and static website generators. These sites are very simple. They're very simple. They're lightweight. They're very quick and they're easy to maintain.
4:49
So this is why we're teaching you that in this chapter. Let's get cracking.