Total Pageviews

Thursday 9 February 2017

搭建基于python2的静态博客程序pdonis-simpleblog

linux vps一般都预装了python.

cd /usr/local
git clone https://github.com/pdonis/simpleblog
cd simpleblog

root@AR:/usr/local/simpleblog# ls
CHANGES     MANIFEST.in     README.md  scripts        setuputils.pyc
CHANGES.md  MANIFEST.in.in  build      setup.py       simpleblog
LICENSE     README          examples   setuputils.py
root@AR:/usr/local/simpleblog# pip install plib.stdlib
(如果直接运行python setup.py install会遇到错误)
root@AR:/usr/local/simpleblog# python setup.py install
(生成的可执行文件为 simpleblog-run)
root@AR:/usr/local/simpleblog# cd examples/bare
root@AR:/usr/local/simpleblog/examples/bare# ls
blog.yaml  config.yaml  entries  static  templates
root@AR:/usr/local/simpleblog/examples/bare# nano blog.yaml
(把charset的值改为utf-8否则发中文帖子会出现乱码
root@AR:/usr/local/simpleblog/examples/bare# cd static
root@AR:/usr/local/simpleblog/examples/bare/static# ls
example-post.html index.html         
root@AR:/usr/local/simpleblog/examples/bare/static#
(可见/usr/local/simpleblog/examples/bare/static就是静态网站的根目录)

 新建源帖:
 root@AR:/usr/local/simpleblog/examples/bare/static# cd ../entries
root@AR:/usr/local/simpleblog/examples/bare/entries# nano test-3.txt
root@AR:/usr/local/simpleblog/examples/bare/entries# cat test-3.txt
测试3
这是测试3.

看看如何?

root@AR:/usr/local/simpleblog/examples/bare/entries# cd ..
root@AR:/usr/local/simpleblog/examples/bare# simpleblog-run render-static
(这个就是生成/更新静态网站的根目录的命令)

演示网站:http://psb.bright.biz.st/
项目地址:https://github.com/pdonis/simpleblog,
 https://github.com/pdonis/simpleblog/issues/1

No comments:

Post a Comment