1)安装pelcan和markdown
pip install pelican markdown --upgrade
2)创建一个文件夹用来作为博客的目录
mkdir 博客目录
3)cd到该目录下运行命令生成博客的框架
cd 博客目录
pelican-quickstart
4)安装过程中会有很多的配置,不知道的可以直接n,后期都是可以进行修改的
> Where do you want to create your new web site? [.]
> What will be the title of this web site? Vent的技术博客
> Who will be the author of this web site? Vent
> What will be the default language of this web site? [Chinese (Simplified)]
> Do you want to specify a URL prefix? e.g., https://example.com (Y/n) n
> Do you want to enable article pagination? (Y/n) y
> How many articles per page do you want? [10]
> What is your time zone? [Europe/Paris]
> 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
> Do you want to upload your website using SSH? (y/N) n
> Do you want to upload your website using Dropbox? (y/N) n
> Do you want to upload your website using S3? (y/N) n
> Do you want to upload your website using Rackspace Cloud Files? (y/N) n
> Do you want to upload your website using GitHub Pages? (y/N) y
> Is this your personal page (username.github.io)? (y/N) y
Done. Your new project is available at C:\Users\lx\Desktop\python\lian\dierzu
5)现在你的目录下会有很多的文件,在content目录下,是你写文章的地方,我们通常情况下使用markdown语法
6)我们现在创建我们的第一个博客
Title: vent的技术博客
Date: 2015-11-28 11:11
Modified: 2015-11-28 11:11
Category: Python
Tags: Python
Slug: Python
Authors: vent
这是我的第一篇文章
7)然后运行命令生成静态网页
pelican content
8)执行之后,output 目录会多出一些文件,我们的markdown文件也会转为html文件放在该目录下
9)网站的主题会设置颜色、布局选项等。尝试一个新主题非常容易,你可以在http://www.pelicanthemes.com/预览其中的许多内容。
10)我们在柏可可的根目录下,将主题克隆下来
git clone https://github.com/getpelican/pelican-themes.git
11)然后再你的目录里会生成pelican-themes文件,这里会有很多的主题来选择。
12)打开pelicanconf.py配置文件内添加自己喜欢的主题
THEME = 'pelican-themes/bootstrap2'
13)在次生成静态页面,并且启动服务
pelican content
pelican --listen
14)访问http://localhost:8000
这个样子我们的博客就已经大功告成了,只要我们把output文件夹push到github就可以进行访问了。
THEME = 'pelican-themes/bootstrap2-dark'
DEFAULT_LANG = 'en'