Pages

Sunday, 2 March 2014

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

git clone https://github.com/eldridgegreg/desult desult-site
cd desult-site

as3:~/desult-site# ls
404.html  cv.html                      images      projects.html
blog      favicon.ico                  includes    README.md
css       google15cdc4f1d65a9f18.html  index.html  resources
as3:~/desult-site#
可见~/desult-site/就是静态网站的根目录。
as3:~/desult-site# nohup Rwebserver 54836 > /dev/null &
访问http://as3.brite.biz:54836/,http://as3.brite.biz:54836/blog/ 即可看到网站效果

发贴方法:
as3:~/desult-site# cd blog
as3:~/desult-site/blog# ls
20120511-engage.html      20120621-fonts.text
20120511-engage.text      20120622_misc.html
20120616-mixer.html       20120622_misc.text
20120616-mixer.text       20120627_ux_driven_development.html
20120619-rswitch.html     20120627_ux_driven_development.text
20120619-rswitch.text     generate.py
201206202-generator.html  index.html
201206202-generator.text  index-template.html
20120620-generate.html    Markdown-License.md
20120620-generate.text    Markdown.pl
20120621-fonts.html       template.html
as3:~/desult-site/blog# nano 20140131-test1.text
按20120621-fonts.text的格式,新建帖子20140131-test1.text,格式如下:
# 测试1
### Sunday, January 31st, 2014

这是测试1.



注意:一定要按照作者的源贴的格式做。不要擅自修改,否则会遇错。
我之前擅自把格式改为:
## 测试1

这是测试1.


 运行更新静态网站的命令python generate.py,
遇到了出错提示:
as3:~/desult-site/blog# python generate.py
Traceback (most recent call last):
  File "generate.py", line 73, in <module>
    main()
  File "generate.py", line 58, in main
    slugs.append(SLUG_FORMAT.format(header,lines[2],lines[4], htmlFile))
IndexError: list index out of range

as3:~/desult-site/blog# python generate.py (这个就是更新静态网站的命令)
as3:~/desult-site/blog#
(按作者的源贴的格式做,就不会出错了)

演示站点:
http://as3.brite.biz:54836/,http://as3.brite.biz:54836/blog/
http://ds.briteming.yi.org,http://ds.briteming.yi.org/blog
http://ds.bright.za.net/,http://ds.bright.za.net/blog
注意:在绑定域名后,访问域名地址,会出现错误:(假设你的webserver 是apache)

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, [no address given] and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.

解决方法:很简单。删除网站根目录下的.htaccess文件或将其改名。

项目地址:https://github.com/eldridgegreg/desult