Total Pageviews

Sunday, 12 January 2014

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

git clone git://github.com/0xAX/static.py.git
cd static.py

as3:~/static.py# ls
LICENSE  README.md  static
as3:~/static.py# cd static
as3:~/static.py/static# ls
res  static
as3:~/static.py/static# ./static -h
Usage: static [options]
Options:
  -h, --help    show this help message and exit
  -c, --create  create new site template
  -b, --build   build site with content
as3:~/static.py/static# ./static --create static.py-site (在当前目录下,会生成博客目录结构:static.py-site目录)
as3:~/static.py/static# ls
res  static  static.py-site
as3:~/static.py/static# ./static --build static.py-site (回答它所提出的问题)
as3:~/static.py/static# ls
res  static  static.py-site
as3:~/static.py/static# cd static.py-site
as3:~/static.py/static/static.py-site# ls
css  index.html  js  posts  README.html
可见~/static.py/static/static.py-site/就是静态网站的根目录。
as3:~/static.py/static/static.py-site# nohup Rwebserver 45320 > /dev/null &
访问http://as3.brite.biz:45320/就可看到网站效果。

发贴方法:
as3:~/static.py/static/static.py-site# cd posts
as3:~/static.py/static/static.py-site/posts# ls
README.md
as3:~/static.py/static/static.py-site/posts# nano test1.md
按README.md的格式,新建帖子test1.md,格式如下:
test1
=====

this is test1.

然后,
as3:~/static.py/static/static.py-site/posts# cd ~/static.py/static/
as3:~/static.py/static# ./static --build static.py-site (这个就是生成/更新静态网站的命令)

演示站点:http://as3.brite.biz:45320/,http://staticpy.brite.biz
项目地址:https://github.com/0xAX/static.py