Total Pageviews

Saturday 30 November 2013

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

pip install acrylamid 
(这样安装的acrylamid是0.7版,这个版本有init功能,正是所需要的版本。不要“克隆它的源码,然后在源码目录里运行python setup.py install”,这样安装的acrylamid是最新版-0.8版而0.8版去掉了init功能,所以这个0.8版就不太好用了,之前就是卡在这里。如果你这样安装了0.8版,请做操作如下:
pip uninstall acrylamid
pip freeze | grep acrylamid (确保输出内容为空)
pip install acrylamid )

as3:~# acrylamid --version
Acrylamid 0.7.7
as3:~# acrylamid -h
usage: acrylamid [-h] [-v] [-q] [-C] [--conf /path/to/conf] [--version]  ...

positional arguments:

    compile             compile blog
    view                fire up built-in webserver
    autocompile         automatic compilation and serving
    info                short summary
    ping                notify resources
    check               run W3C or validate links
    deploy              run task
    import              import content from URL or FILE
    new                 create a new entry
    init                initializes base structure in PATH

as3:~# acrylamid init acrylamid-blog (在当前目录下,该命令会生成acrylamid-blog目录)
as3:~# cd acrylamid-blog
as3:~/acrylamid-blog# ls
conf.py  content  theme
as3:~/acrylamid-blog# acrylamid compile (这个就是生成/更新静态网站的命令)
as3:~/acrylamid-blog# ls
conf.py  content  output  theme  (新出现了output目录)
as3:~/acrylamid-blog# cd output
as3:~/acrylamid-blog/output# ls
2012  articles  atom  index.html  rss  sitemap.xml  style.css  tag
as3:~/acrylamid-blog/output#
(可见,~/acrylamid-blog/output/就是静态网站的根目录)
as3:~/acrylamid-blog/output# nohup Rwebserver 45375 > /dev/null &
(这样访问http://as3.brite.biz:45375/,即可看到网站效果)

as3:~/acrylamid-blog/output# acrylamid new (这是建立新帖子的命令)
Entry's title: test1 (输入帖子的标题)
     create  content/2013/test1.txt
   critical  Could not launch an editor
as3:~/acrylamid-blog/output# cd ..
as3:~/acrylamid-blog# ls
conf.py  content  output  theme
as3:~/acrylamid-blog# nano content/2013/test1.txt
as3:~/acrylamid-blog# cat content/2013/test1.txt
---
title: test1
date: 30.11.2013, 14:34
---
这是测试1.  (header部分已自动建立。只需在此行写正文)
as3:~/acrylamid-blog# acrylamid compile (这个就是生成/更新静态网站的命令)
(当然也可手动新建帖子:
as3:~/acrylamid-blog# nano content/2013/test2.txt
按~/acrylamid-blog/content/sample-entry.txt的内容,得知格式如下:
---
title: test2
date: 30.11.2013, 14:40
tags: [misc1, misc2]
---
这是测试2.

然后:
as3:~/acrylamid-blog# acrylamid compile  )

演示站点:http://as3.brite.biz:45375/,HTTP://arlm.brite.biz
项目地址:https://github.com/posativ/acrylamid,https://posativ.org/acrylamid/commands.html
这个程序真不错,它能对长文自动生成摘要。推荐!