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