Step one is going to be a lot of installing and setting up. Laying the foundation for your site.
The Python syntax is super easy to read and follow. Pelican is also very simple and ideal for you as an introduction to programming. This tutorial will help you set up a blog, a website or both depending on what need is. And host it on GitHub for the world to see.
Installing Python
To install Python, click here, the website should have recognized your operating system.
Working with commandline in terminal
You will be using the command line a lot from now on, now that you have decided to learn to code.
-
Open the terminal on your computer
-
Type
ls
. This will show the files and folders at your start position. You can also see your current folder at the bottom of the command window. -
To change position into a directory, type
cd <directory name>
, and to back out you
typecd ..
. And again typels
to see what folders and files are in the current folder. Move around a bit in your computer's folder structure to get a feel for typing in command line. -
Once you are in the place where you want to make the folder where you want to put your the folder for your website, type
mkdir
and then the name of your folder, for examplemkdir website
. -
Then
cd website
to change position into your directory
Install Pelican and Set Up Your Blog / Website
Coding in Python you will regularly be using a command called pip. pip is Python's package installer. You will be using pip to install various packages from the Python Package Index.
-
Install Pelican with
pip install pelican
-
Next, set up the basic file and folder structure for the website with
pelican-quickstart
. This is called to scaffold. You will be asked the following questions, to help set up the website details.
Welcome to pelican-quickstart v4.8.0.
This script will help you create a new Pelican-based website.
Please answer the following questions so this script can generate the files
needed by Pelican.
> Where do you want to create your new web site? [.] (the [.] means that you are setting up the website in the folder you are in. Hit return for yes)
> What will be the title of this web site? My Favorite Yogurt Toppings (Type the title of the website, you can change this later. Hit return.
> Who will be the author of this web site? me (type your name or pen name, hit return)
> What will be the default language of this web site? [en] en (type the general language for the website, hit return)
> Do you want to specify a URL prefix? e.g., https://example.com (Y/n) n (if your website will be part of a bigger website, this is where you'll type that url, otherwise type n for no)
> Do you want to enable article pagination? (Y/n) y
> How many articles per page do you want? [10] 20
> What is your time zone? [Europe/Rome] America/Los_Angeles
> Do you want to generate a tasks.py/Makefile to automate generation and publishing? (Y/n) y
> Do you want to upload your website using FTP? (y/N) n (you'll be using Github so type n for no)
> Do you want to upload your website using SSH? (y/N) n (you'll be using Github so type n for no)
> Do you want to upload your website using Dropbox? (y/N) n (you'll be using Github so type n for no)
> Do you want to upload your website using S3? (y/N) n (you'll be using Github so type n for no)
> Do you want to upload your website using Rackspace Cloud Files? (y/N) n (you'll be using Github so type n for no)
> Do you want to upload your website using GitHub Pages? (y/N) y ( (you'll be using Github so type y for yes)
> Is this your personal page (username.github.io)? (y/N) n (if you already have a github account you can type it here, otherwise, n for no)
It should say, Done. Your new project is available
. You should now have two folders content and output plus four files Makefile, pelicanconf.py, publishconf.py and task.py
This is this file structure we will be working in the next steps.
COMMENTS