Total Pageviews

Wednesday 22 January 2014

在linux vps上搭建基于python的静态博客程序:flask-rst

git clone https://github.com/jarus/flask-rst
cd flask-rst
python setup.py install
cd example

as3:~/flask-rst/example# flask-rst build
as3:~/flask-rst/example# ls
2011  about.rst  _build  config.py  index.rst
(新出现了_build目录)
as3:~/flask-rst/example# ls _build
2011  about  archive  feed  feed.atom  index.html  static  tags
(可见~/flask-rst/example/_build/就是静态网站的根目录)
as3:~/flask-rst/example# cd _build
as3:~/flask-rst/example/_build# nohup Rwebserver 32184 > /dev/null &
访问http://as3.brite.biz:32184/就可看到网站效果。

发贴方法:
as3:~/flask-rst/example/_build# cd ~/flask-rst/example/2011/10/04/
as3:~/flask-rst/example/2011/10/04# nano test1.rst
按~/flask-rst/example/2011/10/04/里面的hello-world.rst的内容格式,新建帖子test1.rst,格式如下:
test1
=====

:public: True
:tags: ["misc1", "misc2"]
:summary: "点击标题看全文"

这是测试1.
(注意:rst文件的内容默认是“所见即所得”。所以在复制带格式的文章内容时,复制-粘贴即可。而如何使rst文件变成默认的html editor模式,我还未搞明白)
如果想在2014年1月23日发帖,则需在~/flask-rst/example/下新建相应的目录:
as3:~/flask-rst/example/2011/10/04# mkdir -p ~/flask-rst/example/2014/01/23/
as3:~/flask-rst/example/2011/10/04# cd ~/flask-rst/example/2014/01/23/
as3:~/flask-rst/example/2014/01/23# nano xx.rst

然后,
as3:~/flask-rst/example/2011/10/04# cd ~/flask-rst/example
as3:~/flask-rst/example# flask-rst build (这个就是生成/更新静态网站的命令)

演示站点:http://as3.brite.biz:32184,http://fr.brite.biz/
作者的博客http://christophheer.me/ (其源码:https://github.com/jarus/blog)
项目地址:https://github.com/jarus/flask-rst