Total Pageviews

Sunday, 2 March 2014

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

pip install logya
logya create logya-site (此命令会在当前目录下生成logya-site)
cd logya-site

as3:~# pip install logya
as3:~# logya create logya-site
as3:~# cd logya-site
as3:~/logya-site# ls
bin  content  __init__.py  __init__.pyc  site.cfg  static  templates
as3:~/logya-site# logya generate (这就是生成/更新静态网站的命令)
as3:~/logya-site# ls
bin  content  deploy  __init__.py  __init__.pyc  site.cfg  static  templates
(新出现了deploy目录)
as3:~/logya-site# ls deploy
css  img  __index__  index.html  js  recipes  rss.xml
as3:~/logya-site# cd deploy
as3:~/logya-site/deploy# ls
css  img  __index__  index.html  js  recipes  rss.xml
as3:~/logya-site/deploy#
可见~/logya-site/deploy/就是静态网站的根目录。
as3:~/logya-site/deploy# nohup Rwebserver 34285 > /dev/null &
访问http://as3.brite.biz:34285就可看到网站效果。

as3:~/logya-site/
deploy# cd ~/logya-site/
as3:~/logya-site# nano site.cfg
把base_url的值改为http://as3.brite.biz:34285/或绑定的域名地址http://ly.luckypoem.net/
as3:~/logya-site# cat site.cfg
[site]
#base_url=http://yaph.github.com/logya
base_url=http://as3.brite.biz:34285/
#base_url=http://localhost:8080

[templates]
index=index.html
doc=post.html
as3:~/logya-site# nano content/index.html
在此行<p>Logya is a command line tool to generate static Web sites的上一行加上:
<p><a href=/recipes/>点击此处访问博客</a></p>
as3:~/logya-site# logya generate

发贴方法:
as3:~/logya-site# cd content/recipes/
as3:~/logya-site/content/recipes# nano test2.html
按~/logya-site/content/recipes/里面的comments.html的格式,新建帖子test2.html,格式如下:
---
title: 测试2
url: /recipes/test2/
comments: 1
---

这是测试2.


然后,
as3:~/logya-site/content/recipes# cd ~/logya-site
as3:~/logya-site# logya generate

演示站点:http://as3.brite.biz:34285/,http://ly.briteming.yi.org
项目地址:https://github.com/yaph/logya,http://pythonhosted.org/logya/