#100DaysOfWeb in Python Transcripts
Chapter: Days 29-32: Static Sites
Lecture: Configure Pelican
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
Next up, we are in our folder. We now have to install Pelican which is the static site generator we are using for this chapter.
0:10
To do that, the very first thing is, what? Yes, that's right, we are going to create our virtual environment.
0:17
So, I'm creating one as usual called venv. So, Python -m venv venv. Once that is installed, we simply pip install pelican and pip install markdown
0:31
because we are going to be using Markdown for all of our documentation here for all of our source files. Let's do that now.
0:38
We should have the venv folder. So, activate your virtual environment. Remember, using Mac, that will be source venv/bin/activate
0:48
but on Windows, we can just use the batch file. With the venv there, let's do pip install pelican markdown. All right, with that done
1:06
we can then do a pip list, make sure we have it all there. That all looks good. Let's do a pip freeze into requirements.txt
1:17
just to make sure we have all that backed up. All right. And that's all we have in our repo. Now, what we are going to do is create a skeleton project.
1:28
This is pretty much installing Pelican. This is pretty much setting up our static website for Pelican, for Pelican to use it
1:37
take all the source files and convert it to HTML and we're using the Pelican framework to do that. So, we'll do pelican-quickstart
1:47
and this will actually take us through a bit of a guided website. So, where do you want to create your new website?
1:54
Anyone who's familiar with the command line will know dot means present directory or current working directory
1:59
so we'll continue leaving that as the default. We're just going to create the website here in this folder. What will be the title of the website?
2:09
Look, you know what? Just use whatever you used for the repo. I'm just going to call it 100 Days of Web site. Who will be the author of the website?
2:20
Throw in whatever name you want, it doesn't matter. What will be the default language? Mine is English. Do you want to specify a URL?
2:28
Now, I don't have a URL prefix for this website because I haven't bought a domain so I'm just going to hit No for now.
2:37
And just bear with me, we will deploy this later so we don't necessarily need that just now. Do you want to enable article pagination?
2:47
Now, what that means is when you have a certain amount of articles on one page it will then create a second sort of index page
2:57
so you don't have an infinite scrolling index page with every article you've ever made. It will say, okay, here are the first
3:05
here are the latest five or 10 articles hit number two to move on to previous articles written. So, we're going to say yes, we do want that.
3:15
How many articles a page do you want? So, the default is 10. As I said, it will display the latest 10 and everything that was made prior to that
3:22
will be on a different page. So, let's just go by the default, to 10. What is your time zone? Enter in your time zone here. Mine is Australia, Sydney.
3:34
Do you want to generate a tasks.py/Makefile to automate generation and publishing? For this, just say yes.
3:43
Do you want to upload your website using FTP? No. SSH? No. Dropbox. No. S3. No. They're pretty thorough, aren't they? Rackspace. No. GitHub Pages. No.
3:59
The reason I'm selecting no for all those is we want to control everything. Let's just get rid of all that config we don't want that there.
4:08
Now, super exciting. We do an ls. Look at that. Look at that lovely stuff there for our Pelican to eat.
4:17
Now, what we have here is a very basic framework. There is nothing here for us to generate. Pelican, what it does is it actually takes everything
4:27
that's in our content folder and generate it into a site. There is nothing there. So, we're going to limit this to this video
4:35
get your environment set up pip install Pelican and Markdown and then go through the pelican-quickstart. We'll start creating files in the next video.