跳转至

快速开始与命令

安装

  1. 安装好python3pip(默认为最新版本)

  2. 克隆仓库到本地: git clone https://github.com/zcmimi/py-blog.git

    或从release页面下载已发布的稳定版, 解压

    然后进入项目目录cd py-blog,你也可以把文件夹重命名为你喜欢的名字

  3. 运行blog.py

渲染博客

python blog.py g

效果:

$ ./blog.py g
read in 0.008s
sort in 0.000s
generate in 0.000s
copy assets in 0.340s
compile templates in 0.089s
render in 0.143s

预览

启动服务器预览博客

python blog.py s

效果:

$ ./blog.py s
 * Serving Flask app "blog" (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
 * Running on http://127.0.0.1:3399/ (Press CTRL+C to quit)

帮助

python3 blog.py./blog.py以查看帮助

1. [g/generate]: 渲染博客,生成的文件在自定义文件夹中
2. [cl/clean]: 清空输出文件夹
3. [s/server]: 预览博客(动态)
4. [n/new] + [title]: 新建文章
5. [np/newpage] + [title]: 新建页面
6. [d/deploy]: 部署博客
7. [S/Server]: 预览博客(静态,预览渲染后的文件)
8. [sp/seopush]: 搜索引擎推送

部署

详见部署

渲染博客并添加仓库后

python blog.py d

效果(同时推送到coding与github):

$ ./blog.py d
[master e239042] .
 1128 files changed, 9743 insertions(+), 8734 deletions(-)
 create mode 100644 "posts/LG 1972 [SDOI2009]HH\347\232\204\351\241\271\351\223\276/index.html"
 create mode 100644 "tags/\346\240\221\347\212\266\346\225\260\347\273\204/page/4/index.html"
Enumerating objects: 3804, done.
Counting objects: 100% (3804/3804), done.
Delta compression using up to 4 threads
Compressing objects: 100% (1192/1192), done.
Writing objects: 100% (2292/2292), 1.54 MiB | 1.36 MiB/s, done.
Total 2292 (delta 1122), reused 0 (delta 0)
remote: Resolving deltas: 100% (1122/1122), completed with 393 local objects.
To e.coding.net:zcmimi/blog.git
   6316916..e239042  master -> master
Enumerating objects: 3804, done.
Counting objects: 100% (3804/3804), done.
Delta compression using up to 4 threads
Compressing objects: 100% (1192/1192), done.
Writing objects: 100% (2292/2292), 1.55 MiB | 709.00 KiB/s, done.
Total 2292 (delta 1122), reused 0 (delta 0)
remote: Resolving deltas: 100% (1122/1122), completed with 393 local objects.
To github.com:zcmimi/zcmimi.github.io.git
   6316916..e239042  master -> master

自定义配置

编辑根目录config.yml和主题中的config.yml

详见自定义配置