Pages

Wednesday, 6 November 2013

在linux vps下搭建基于python的静态博客程序handcrank

pip install handcrank
handcrank --sitedir handcrank-site startsite (该命令会在当前目录下,生成handcrank-site目录)
cd handcrank-site
ls
config.cfg  docs  template
handcrank --sitedir . generate (该命令会在当前目录下,生成output目录)
as3:~/handcrank-site# ls
config.cfg  docs  output  template
as3:~/handcrank-site# cd output
as3:~/handcrank-site/output# ls
css  img  index.html  js  (可见~/handcrank-site/output/就是静态网站的根目录)
as3:~/handcrank-site/output# cd ..
as3:~/handcrank-site# cd docs
as3:~/handcrank-site/docs# ls
getstarted.rst
按~/handcrank-site/docs/里的getstarted.rst的格式,新建帖子test2.rst,格式如下:
===============
test2 (标题不能用中文)
===============

this is test2. (正文也不能用中文。上述的=线要跟标题的文字一样长,最好比标题的文字长一倍)

如果要嵌入html code,比如一个视频代码,请注意格式:
=======================
wether sunshine or rain
=======================

.. raw:: html
(这里还要空一行)
   <embed src="http://player.youku.com/player.php/sid/XMjEzODIwODY0/v.swf"
          quality="high"
          width="500"
          height="400"
          align="middle"
          allowscriptaccess="sameDomain"
          type="application/x-shockwave-flash" />
   </embed> 

<p>虽然周华健长得有点玩世不恭,但唱的情歌还是挺不错的.</p>

上面的<embed 要往右空3格才写!
然后
as3:~/handcrank-site/docs# cd ..
as3:~/handcrank-site# handcrank --sitedir . generate

演示站点:http://hc.brite.biz/
嵌入的视频演示:http://hc.brite.biz/#fengyuwuzu.rst

项目地址:https://github.com/robmadole/handcrank,
http://pythonhosted.org/handcrank/#welcome.rst