设为首页 收藏本站
查看: 1052|回复: 0

[经验分享] pelican github搭建博客

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2016-8-2 09:34:11 | 显示全部楼层 |阅读模式
Title: 使用Pelican搭建博客系统
Date: 2016-07-30 22:20
Modified: 2016-07-30 22:20
Tags: python, pelican
Slug:  
Authors: Peng Ruifang
Summary: 本文介绍了Pelican的特性,搭建出一个可运行的独立博客系统。
Status: draft




# 目录
---
[TOC]
http://pelican-docs-zh-cn.readthedocs.io/en/latest/

---
## CentOS6 install Python2.7
```shell
wget https://www.python.org/ftp/python/2.7.12/Python-2.7.12.tgz
tar -zxvf Python*.tgz
cd Python*
./configure  
make all            
make install  
make clean  
make distclean
```

```shell
mv /usr/bin/python /usr/bin/python2.6.6  
ln -s /usr/local/bin/python2.7 /usr/bin/python

vi /usr/bin/yum  

#!/usr/bin/python
改成
#!/usr/bin/python2.6
```
## Install Pip
```
wget https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py
```
### ubuntu install pip

Ubuntu下安装pip的方法

安装pip的方法:
```
sudo apt-get install python-pip python-dev build-essential
sudo pip install --upgrade pip
sudo pip install --upgrade virtualenv

```
```
For older versions of Ubuntu
Install Easy Install
$ sudo apt-get install python-setuptools python-dev build-essential
Install pip
$ sudo easy_install pip
Install virtualenv
$ sudo pip install --upgrade virtualenv
```
---
## Install pelican markdown

```
$ sudo pip install pelican markdown
```

---
## Init pelican env
```
mkdir -p /home/wwwroot/init.wang
cd  /home/wwwroot/init.wang
$ sudo pelican-quickstart
ok@ok-pc:~/pelican$ sudo pelican-quickstart
Welcome to pelican-quickstart v3.6.3.

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? [.]
> What will be the title of this web site? 一起走过的日子
> Who will be the author of this web site? PengRuifang
> What will be the default language of this web site? [en] zh
> Do you want to specify a URL prefix? e.g., http://example.com   (Y/n) n
> Do you want to enable article pagination? (Y/n)
> How many articles per page do you want? [10]
> What is your time zone? [Europe/Paris] Asia/Shanghai
> Do you want to generate a Fabfile/Makefile to automate generation and publishing? (Y/n)
> Do you want an auto-reload & simpleHTTP script to assist with theme and site development? (Y/n)
> 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)  
Done. Your new project is available at /home/ok/pelican

```

Then,the files like below:
```
ok@ok-pc:~/pelican$ tree
.
├── content
├── develop_server.sh
├── fabfile.py
├── get-pip.py
├── Makefile
├── output
├── pelicanconf.py
└── publishconf.py

2 directories, 6 files
```

---
##  First pelican page
```
cd ./content
vim test1.md

Title: My super title
Date: 2010-12-03 10:20
Modified: 2010-12-05 19:30
Category: Python
Tags: pelican, publishing
Slug: my-super-post
Authors: Alexis Metaireau, Conan Doyle
Summary: Short version for index and feeds

This is the content of my super blog post.
```

```
cd ../content
pelican ./content
cd ./output
python -m SimpleHTTPServer

firefox 127.0.0.1:8000
```
## Upload the pages to Github
```
ssh-keygen -t rsa  -b 4096 -C "okeyear@163.com"
cd ~/.ssh
cat id_rsa.pub  #内容复制到github的ssh keys里面
然后本机
ssh -T git@github.com



```
github新建一项目,必须以自己用户名开始,并且以.github.com 或.github.io结尾
比如:okeyear.github.com
```
cd ./output
git init
git add .
git commit -m "pelican blog test"
# git remote rm origin
git remote add origin git@github.com:okeyear/okeyear.github.com.git
git push -u origin master



```

### pelican theme

```
git clone https://github.com/getpelican/pelican-themes.git
从里面拷贝一份你选中的主题到项目根目录的 themes 目录下
然后在 pelicanconf.py 和 publishconf.py 里通过下面代码指定博客主题:
THEME = "themes/foundation-default-colours"

FOUNDATION_FRONT_PAGE_FULL_ARTICLES = False
FOUNDATION_ALTERNATE_FONTS = False
FOUNDATION_TAGS_IN_MOBILE_SIDEBAR = False
FOUNDATION_NEW_ANALYTICS = False
FOUNDATION_ANALYTICS_DOMAIN = ''
FOUNDATION_FOOTER_TEXT = 'Powered by <a href="http://getpelican.com">Pelican</a> and <a href="http://foundation.zurb.com/">Zurb Foundation</a>. Theme by <a href="http://hamaluik.com">Kenton Hamaluik</a>.'
FOUNDATION_PYGMENT_THEME = 'monokai'
```

### 域名解析

添加一CNAME文件,无后缀名,里面写上自己的域名;

域名解析地方添加CNAME,指向okeyear.github.io

### 博客模版
```
Title: 使用Pelican搭建博客系统
Date: 2014-10-07 22:20
Modified: 2014-10-07 23:04
Tags: python, pelican
Slug: build-blog-system-by-pelican
Authors: Joey Huang
Summary: 本文介绍了Pelican的特性;选择Pelican的理由以及从头安装配置,搭建出一个可运行的独立博客系统。
Status: draft
```


运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-251991-1-1.html 上篇帖子: git编译安装完成之后fatal: Unable to find remote helper for 'https' 下篇帖子: git 基本操作指令 博客
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表