pip install Jinja2 Markdown Pygments
git clone https://github.com/scturtle/turtleblog.git
然后按https://github.com/mayoff/python-markdown-mathjax的说明,安装python-markdown-mathjax。我是按其第一种方法安装的:
运行python -c 'import markdown; print markdown.__path__[0]'
显示:/usr/local/lib/python2.7/site-packages/markdown/,此目录下有个extensions子目录。进入此子目录,新建文件mathjax.py,把https://github.com/mayoff/python-markdown-mathjax/blob/master/mdx_mathjax.py所显示的代码内容粘贴到mathjax.py里面,保存文件。
返回turtleblog目录。编辑config.json文件,输入你自己的数据。
运行python turtle.py ,就会在当前目录下生成html目录,此html目录就是静态网站的根目录。
as3:/usr/local/lib/python2.7/site-packages/markdown/extensions# cd ~/turtleblog
as3:~/turtleblog# ls
blog config.json page readme.md server.py static template turtle.py
as3:~/turtleblog# python turtle.py
as3:~/turtleblog# ls
blog html readme.md static turtle.py
config.json page server.py template
(新出现了html目录)
as3:~/turtleblog# ls html
2012 about archive.html atom.xml index.html page static tags
as3:~/turtleblog#
可见~/turtleblog/html/就是静态网站的根目录。
as3:~/turtleblog# cd html
as3:~/turtleblog/html# ls
2012 about archive.html atom.xml index.html page static tags
as3:~/turtleblog/html# nohup Rwebserver 34249 > /dev/null &
[1] 20882
as3:~/turtleblog/html# nohup: ignoring input and redirecting stderr to stdout
as3:~/turtleblog/html#
访问http://as3.brite.biz:34249即可看到网站效果。
发贴方法:
as3:~/turtleblog/html# cd ../blog
as3:~/turtleblog/blog# cd 2012
as3:~/turtleblog/blog/2012# cd 0715-test
as3:~/turtleblog/blog/2012/0715-test# ls
blog.md config.json img
as3:~/turtleblog/blog/2012/0715-test# cat config.json
{
"title":"测试",
"tags":"other",
"date":"2012-7-15 10:00",
"enable mathjax":true
}
as3:~/turtleblog/blog/2012/0715-test# cat blog.md
# 测试
## 测试
### 测试
as3:~/turtleblog/blog/2012/0715-test#
as3:~/turtleblog/blog/2012/0715-test# mkdir -p ~/turtleblog/blog/2013/1207-test1
as3:~/turtleblog/blog/2012# cd ~/turtleblog/blog/2013/1207-test1
as3:~/turtleblog/blog/2013/1207-test1# nano config.json
as3:~/turtleblog/blog/2013/1207-test1# ls
config.json
as3:~/turtleblog/blog/2013/1207-test1# nano blog.md
as3:~/turtleblog/blog/2013/1207-test1# ls
blog.md config.json
as3:~/turtleblog/blog/2013/1207-test1# cat config.json
{
"title":"测试1",
"tags":"other",
"date":"2013-12-07 10:00",
"enable mathjax":true
}
as3:~/turtleblog/blog/2013/1207-test1# cat blog.md
这是测试1.
as3:~/turtleblog/blog/2013/1207-test1# cd ~/turtleblog/
as3:~/turtleblog# python turtle.py (这个就是生成/更新静态网站的命令)
as3:~/turtleblog#
演示站点:http://tb.brite.biz/,http://as3.brite.biz:34249/
项目地址:https://github.com/scturtle/turtleblog
注意:我的webserver是apache,须如下修改apache的配置文件:
<VirtualHost vps-ip:80>
ServerName tb.brite.biz
DocumentRoot /root/turtleblog/html/
<Directory /root/turtleblog/html/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
如果不加上蓝色部分,那么在访问http://tb.brite.biz/page/2之类地址时,会显示not found.其实http://tb.brite.biz/page/2.html也是可访问的。
git clone https://github.com/scturtle/turtleblog.git
然后按https://github.com/mayoff/python-markdown-mathjax的说明,安装python-markdown-mathjax。我是按其第一种方法安装的:
运行python -c 'import markdown; print markdown.__path__[0]'
显示:/usr/local/lib/python2.7/site-packages/markdown/,此目录下有个extensions子目录。进入此子目录,新建文件mathjax.py,把https://github.com/mayoff/python-markdown-mathjax/blob/master/mdx_mathjax.py所显示的代码内容粘贴到mathjax.py里面,保存文件。
返回turtleblog目录。编辑config.json文件,输入你自己的数据。
运行python turtle.py ,就会在当前目录下生成html目录,此html目录就是静态网站的根目录。
as3:/usr/local/lib/python2.7/site-packages/markdown/extensions# cd ~/turtleblog
as3:~/turtleblog# ls
blog config.json page readme.md server.py static template turtle.py
as3:~/turtleblog# python turtle.py
as3:~/turtleblog# ls
blog html readme.md static turtle.py
config.json page server.py template
(新出现了html目录)
as3:~/turtleblog# ls html
2012 about archive.html atom.xml index.html page static tags
as3:~/turtleblog#
可见~/turtleblog/html/就是静态网站的根目录。
as3:~/turtleblog# cd html
as3:~/turtleblog/html# ls
2012 about archive.html atom.xml index.html page static tags
as3:~/turtleblog/html# nohup Rwebserver 34249 > /dev/null &
[1] 20882
as3:~/turtleblog/html# nohup: ignoring input and redirecting stderr to stdout
as3:~/turtleblog/html#
访问http://as3.brite.biz:34249即可看到网站效果。
发贴方法:
as3:~/turtleblog/html# cd ../blog
as3:~/turtleblog/blog# cd 2012
as3:~/turtleblog/blog/2012# cd 0715-test
as3:~/turtleblog/blog/2012/0715-test# ls
blog.md config.json img
as3:~/turtleblog/blog/2012/0715-test# cat config.json
{
"title":"测试",
"tags":"other",
"date":"2012-7-15 10:00",
"enable mathjax":true
}
as3:~/turtleblog/blog/2012/0715-test# cat blog.md
# 测试
## 测试
### 测试
as3:~/turtleblog/blog/2012/0715-test#
as3:~/turtleblog/blog/2012/0715-test# mkdir -p ~/turtleblog/blog/2013/1207-test1
as3:~/turtleblog/blog/2012# cd ~/turtleblog/blog/2013/1207-test1
as3:~/turtleblog/blog/2013/1207-test1# nano config.json
as3:~/turtleblog/blog/2013/1207-test1# ls
config.json
as3:~/turtleblog/blog/2013/1207-test1# nano blog.md
as3:~/turtleblog/blog/2013/1207-test1# ls
blog.md config.json
as3:~/turtleblog/blog/2013/1207-test1# cat config.json
{
"title":"测试1",
"tags":"other",
"date":"2013-12-07 10:00",
"enable mathjax":true
}
as3:~/turtleblog/blog/2013/1207-test1# cat blog.md
这是测试1.
as3:~/turtleblog/blog/2013/1207-test1# cd ~/turtleblog/
as3:~/turtleblog# python turtle.py (这个就是生成/更新静态网站的命令)
as3:~/turtleblog#
演示站点:http://tb.brite.biz/,http://as3.brite.biz:34249/
项目地址:https://github.com/scturtle/turtleblog
注意:我的webserver是apache,须如下修改apache的配置文件:
<VirtualHost vps-ip:80>
ServerName tb.brite.biz
DocumentRoot /root/turtleblog/html/
<Directory /root/turtleblog/html/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
如果不加上蓝色部分,那么在访问http://tb.brite.biz/page/2之类地址时,会显示not found.其实http://tb.brite.biz/page/2.html也是可访问的。