Total Pageviews

Thursday 24 April 2014

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

git clone https://github.com/semk/voldemort
cd voldemort
pip install -r requirements.txt
python setup.py install

as3:~/voldemort# git clone https://github.com/semk/foobarnbaz.com foobarnbaz.com-site
as3:~/voldemort# cd foobarnbaz.com-site
as3:~/voldemort/foobarnbaz.com-site# ls
about.markdown  games.html  javascripts         posts          stylesheets
archive.html    images      lab.html            robots.txt     tag.html
atom.xml        include     layout              settings.yaml 
fonts           index.html  not-found-404.html  sitemap.xml
as3:~/voldemort/foobarnbaz.com-site# voldemort -h
Usage: voldemort [options]
Options:
  -h, --help            show this help message and exit
  -s, --serve           Start the HTTP Server
  -p PORT, --port=PORT  Port inwhich the HTTPServer should run
as3:~/voldemort/foobarnbaz.com-site# voldemort (这个就是生成/更新静态网站的命令)
as3:~/voldemort/foobarnbaz.com-site# ls
about.markdown  games.html    javascripts         Pushing        stylesheets
Adding          images        lab.html            robots.txt     tag.html
archive.html    include       layout              settings.yaml  Voldemort
atom.xml        index.html    not-found-404.html  _site          voldemort.log
fonts           Initializing  posts               sitemap.xml
(新出现了_site目录)
as3:~/voldemort/foobarnbaz.com-site# cd _site
as3:~/voldemort/foobarnbaz.com-site/_site# ls
2010   Adding    index.html     page2  Pushing        Voldemort
2011   archive   Initializing   page3  robots.txt     voldemort.log
2012   atom.xml  javascripts    page4  settings.yaml
2013   fonts     lab            page5  sitemap.xml
2014   games     not-found-404  page6  stylesheets
about  images    page1          page7  tag
(可见~/voldemort/foobarnbaz.com-site/_site就是静态网站的根目录。)
as3:~/voldemort/foobarnbaz.com-site/_site# nohup Rwebserver 45382 > /dev/null &
访问http://as3.brite.biz:45382即可看到网站效果。

发贴方法:
as3:~/voldemort/foobarnbaz.com-site# cd posts
as3:~/voldemort/foobarnbaz.com-site/posts# nano test1.markdown
按~/voldemort/foobarnbaz.com-site/posts/里面某个markdown文件的格式,新建帖子

test1.markdown,格式如下:
---
title: test1
date: '20-04-2014'
time: '17:36'
tags: ['misc1', 'misc2']
layout: 'post.html'
---

这是测试1.

然后,
as3:~/voldemort/foobarnbaz.com-site/posts# cd ..
as3:~/voldemort/foobarnbaz.com-site# voldemort

演示站点:http://as3.brite.biz:45382/,http://vdm.brite.biz.st
程序作者的示范站点:http://foobarnbaz.com
项目地址:https://github.com/semk/voldemort
https://github.com/semk/foobarnbaz.com