Total Pageviews

Sunday 19 March 2017

搭建基于python2.7的静态博客程序statik

pip install virtualenv
virtualenv dev
cd ~/dev
source bin/activate (这样就启用了python的虚拟环境)
pip install statik ( statik的可执行文件将会出现在~/dev/bin/)

cd /usr/local
git clone https://github.com/FuzzyWuzzie/hamaluik.com
cd hamaluik.com

(dev) root@AR:/usr/local/hamaluik.com# ls
LICENSE    assets      data  templatetags    views
README.md  config.yml  models  templates  upload.sh
(dev) root@AR:/usr/local/hamaluik.com# statik (此即生成/更新静态网站的根目录的命令)
(dev) root@AR:/usr/local/hamaluik.com# ls
LICENSE    assets      data    public      templatetags    views
README.md  config.yml  models  templates  upload.sh
(生成了public目录)
(dev) root@AR:/usr/local/hamaluik.com# cd public
(dev) root@AR:/usr/local/hamaluik.com/public# ls
about  assets  index.html  posts  tags
(dev) root@AR:/usr/local/hamaluik.com/public#
(可见/usr/local/hamaluik.com/public就是静态网站的根目录)

新建源帖:
dev) root@AR:/usr/local/hamaluik.com/public# cd ../data/Post
(dev) root@AR:/usr/local/hamaluik.com/data/Post# nano 2017-03-19-test-1.md
(dev) root@AR:/usr/local/hamaluik.com/data/Post# cat 2017-03-19-test-1.md
---
title: "测试1
slug: test-1
author: brite
tags: [misc]
published: 2017-03-19 12:29:00
---

这是测试1.


看看如何?
(dev) root@AR:/usr/local/hamaluik.com/data/Post# cd ../..
(dev) root@AR:/usr/local/hamaluik.com# statik

演示网站:http://hml.bright.biz.st/
项目地址:https://github.com/thanethomson/statik , https://getstatik.com/
https://github.com/FuzzyWuzzie/hamaluik.com

注:如果title的值含有中文,则title的值一定要加上英文双引号。

注:建议在python的虚拟环境下搭建,否则可能遇错:https://github.com/thanethomson/statik/issues/34
-------------

source ~/dev/bin/activate
cd /usr/local
mkdir statik-site
cd statik-site
git clonehttps://github.com/thanethomson/blog thanethomson.com
cd thanethomson.com

(dev) root@localhost:/usr/local/statik-site/thanethomson.com# ls
assets      config-dev.yml  models  README.md  views
bower.json  data   templates
(dev) root@localhost:/usr/local/statik-site/thanethomson.com# mv config-dev.yml config.yml
(dev) root@localhost:/usr/local/statik-site/thanethomson.com# statik   (此即生成/更新静态网站的根目录的命令)
(dev) root@localhost:/usr/local/statik-site/thanethomson.com# ls
assets      config.yml  models  README.md  views
bower.json  data        public  templates
(生成了public目录)
(dev) root@localhost:/usr/local/statik-site/thanethomson.com#  cd public
(dev) root@localhost:/usr/local/statik-site/thanethomson.com/public# ls
2011  2013  2015  2017      about   index.html  page
2012  2014  2016  404.html  assets  index.xml   tags
(dev) root@localhost:/usr/local/statik-site/thanethomson.com/public#
(可见/usr/local/statik-site/thanethomson.com/public就是静态网站的根目录)

新建源帖:
(dev) root@localhost:/usr/local/statik-site/thanethomson.com/public# cd ../data/Post
(dev) root@localhost:/usr/local/statik-site/thanethomson.com/data/Post# nano 2017-04-04-test-1.md
(dev) root@localhost:/usr/local/statik-site/thanethomson.com/data/Post# cat 2017-04-04-test-1.md
---
title: "测试1"
slug: test-1
summary: >
   点击标题,看全文
date: 2017-04-04 10:08:00
tags:
   - misc1
   - misc2
   - misc3
---

这是测试1.

看看如何?

(dev) root@localhost:/usr/local/statik-site/thanethomson.com/data/Post# cd ../..
(dev) root@localhost:/usr/local/statik-site/thanethomson.com# statik

注:如果title的值含有中文,则title的值一定要加上英文双引号。

演示网站:http://ttc.bright.biz.st/
项目地址:https://github.com/thanethomson/statik
https://github.com/thanethomson/blog/
https://github.com/thanethomson/blog/issues/1

No comments:

Post a Comment