Total Pageviews

Saturday, 24 May 2014

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

git clone https://github.com/shazow/composer composer-site
cd composer-site
python setup.py install
pip install -r optional.txt
pip install markdown2

as3:~/composer-site# ls
build        Composer.egg-info  LICENSE.txt   README.rst  test
CHANGES.rst  dist               MANIFEST.in   setup.cfg
composer     examples           optional.txt  setup.py
as3:~/composer-site# cd examples
as3:~/composer-site/examples# git clone https://github.com/shazow/shazow.net shazow.net-site
as3:~/composer-site/examples# cd shazow.net-site
as3:~/composer-site/examples/shazow.net-site# ls
_everything  index.json  README.md         _static
indexer.py   Makefile    requirements.txt  _templates
as3:~/composer-site/examples/shazow.net-site# pip install -r requirements.txt
as3:~/composer-site/examples/shazow.net-site# cd _everything
as3:~/composer-site/examples/shazow.net-site/_everything# git clone https://github.com/shazow/everything
as3:~/composer-site/examples/shazow.net-site/_everything# mv everything/* .
as3:~/composer-site/examples/shazow.net-site# composer build index.json (这个就是生成/更新静态网站的命令)
as3:~/composer-site/examples/shazow.net-site# ls
build        indexer.py  Makefile   requirements.txt      _static
_everything  index.json  README.md  requirements.txt.log  _templates
(新出现了build目录)
as3:~/composer-site/examples/shazow.net-site# ls build
favicon.ico  index.html  newsletter  static
as3:~/composer-site/examples/shazow.net-site# cd build
as3:~/composer-site/examples/shazow.net-site/build# ls
everything favicon.ico  index.html  newsletter  static
(可见~/composer-site/examples/shazow.net-site/build/就是静态网站的根目录)
as3:~/composer-site/examples/shazow.net-site/build# nohup Rwebserver 21088 > /dev/null &
访问http://as3.brite.biz:21088/即可看到网站效果。

发贴方法:
as3:~/composer-site/examples/shazow.net-site/build# cd ../_everything/
as3:~/composer-site/examples/shazow.net-site/_everything# nano test1.md
格式为:
# test1

这是测试1.

然后,
as3:~/composer-site/examples/shazow.net-site/_everything# cd ..
as3:~/composer-site/examples/shazow.net-site# nano index.json
(
"url": "/newsletter"
},的下一行加上:
{
            "context": {
                "email": "andrey.petrov@shazow.net",
                "name": "ym",
                "tags": [
                    "post"
                ],
                "time_created": "1287615713",
                "time_updated": "1333169896",
                "title": "测试1"
            },
            "file": "_everything/test1.md",
            "filters": [
                "markdown",
                "post",
                "pygments"
            ],
            "url": "/everything/test1"
},
as3:~/composer-site/examples/shazow.net-site# composer build index.json (这个就是生成/更新静态网站的命令)

演示站点:http://as3.brite.biz:21088/,http://cps.brite.biz.st
项目地址:https://github.com/shazow/composer
https://github.com/shazow/shazow.net
https://github.com/shazow/everything