Total Pageviews

Thursday, 16 January 2014

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

git clone https://github.com/xfire/growl
cd growl
ln -s growl.py /usr/local/bin/growl.py (如果你想偷懒,运行python setup.py install也行。运行python setup.py install后,growl.py会被复制到/usr/local/bin/里面)
(growl doesn't generate a "default structure". it simply take what's inside the source directory and convert it to the output directory. to get a starting point, you can clone a existing site,for example,http://github.com/xfire/downgrade and modify it by your needs.
growl并不会生成默认的博客目录结构,你可去克隆作者已经建立的站点的目录结构:http://github.com/xfire/downgrade)

as3:~/growl# mkdir growl-site
as3:~/growl# cd growl-site
as3:~/growl/growl-site# git clone https://github.com/xfire/downgrade
as3:~/growl/growl-site# mv ~/growl/growl-site/downgrade/* ~/growl/growl-site/
as3:~/growl/growl-site# ls
atom.xml_  _hooks   index.html_     _layout  _posts
css        files    impressum.html  js       _libs    unpublished.html_
as3:~/growl/growl-site# cd ..
as3:~/growl# growl.py --serve=34673 growl-site
访问http://as3.brite.biz:34673就可临时查看一下网站效果。
按ctrl+c退出控制台。 此时网站就得到更新了。

as3:~/growl# ls growl-site
atom.xml_  _deploy  _hooks          index.html_  _layout  _posts
css        files    impressum.html  js           _libs    unpublished.html_
(可以看到新出现了_deploy目录)
as3:~/growl# cd growl-site/_deploy
as3:~/growl/growl-site/_deploy# ls
2009  atom.xml  files           index.html  unpublished.html
2010  css       impressum.html  js
as3:~/growl/growl-site/_deploy#
可见~/growl/growl-site/_deploy/就是静态网站的根目录。
as3:~/growl/growl-site/_deploy# nohup Rwebserver 56281 > /dev/null &
访问http://as3.brite.biz:56281/可看到网站效果。

发贴方法:
as3:~/growl/growl-site/_deploy# cd ..
as3:~/growl/growl-site# cd _posts
as3:~/growl/growl-site/_posts# nano 2014-01-17-test1.md2
按~/growl/growl-site/_posts/里的某个md2文件,比如2010-07-15-scala_self-types.md2的内容格式,新建帖子2014-01-17-test1.md2,格式如下:
---
layout: post
title: test1
categories: misc1, misc2
---

this is test1.
(标题,内容都不能为中文)
update:如果帖子的扩展名改为md,则标题,内容都能为中文。

然后,
as3:~/growl/growl-site/_posts# cd ~/growl
as3:~/growl# growl.py --serve=34673 growl-site(这个就是生成/更新静态网站的命令)
 按ctrl+c退出控制台。 此时网站就得到更新了。

演示站点:http://as3.brite.biz:56281/,http://growl.brite.biz
程序作者的演示站点http://downgra.de/
http://achinghead.com(其源码: https://github.com/waylan/achinghead.com )
项目地址:https://github.com/xfire/growl,https://github.com/xfire/downgrade