/blog

Pelican as static blog for http://blog.pychina.org

Primary LanguageCSS

PyChina.org

in fact from 2003 there is CZUG.org ~ the 1st(and only one) focus Zope tech community be set up;

so years ago, there is soooooooo many python tech abt. commuity in China

but never group as one unify community brand, like as: perl-china/ruby-china etc.

so after PyCon2013China, some old Chinese Pythonista together and building:

goal

  • by Pythonner in China Operations
  • as Pythonner in China Deleloping
  • for Pythonista in Global support events organizing srvice

organizer

  • Zoom.Quiet

volunteer

cnpycon-volunteer cnpycon-volunteer@googlegroups.com

usage

How to update the site contents?

as summary:

  • generating all pages in local by Pelican
  • usage qrsync push into pychina.qiniudn.com
  • finally Nginx+DNS publish as http://pychina.org/

depending:

  • Python
  • Pelican
  • git
  • fabric

install:

$ pip install -r requirements.txt

flow

配置好环境

  • 安装 fabric 1.0
  • 将本地目录按照这样部署:

path/2/PyChina.org/blog༽

༄  git br -a
* master
  remotes/origin/HEAD -> origin/master
  remotes/origin/gh-pages
  remotes/origin/gitcafe-pages
  remotes/origin/master

༄  ll
total 48
-rw-r--r--  1 zoomq staff 3758  8  7  2015 Makefile
-rw-r--r--  1 zoomq staff 4280  9 15 09:41 README.md
...
lrwxr-xr-x  1 zoomq staff   12  8 23 21:59 output -> ../blog_ghp/
...

path/2/PyChina.org/blog_ghp༽

༄  git br -a
* gh-pages
  master
  remotes/origin/HEAD -> origin/master
  remotes/origin/gh-pages
  remotes/origin/master

然后, 想编译发布时:

༄  fab pub
[localhost] local: pelican content -o output -s pelicanconf.py
WARNING: MD_EXTENSIONS is deprecated use MARKDOWN instead. Falling back to the default.
ERROR: Skipping _extra/README.md: could not find information about 'title'
Done: Processed 11 articles, 0 drafts, 1 page and 0 hidden pages in 2.15 seconds.
[localhost] local: cd output && pwd && git st && git add --all . && git ci -am "re-build from local by markdoc @MBP111216ZQ" && git pu && date
/Users/zoomq/Sites/PyChina.org/blog/output
On branch gh-pages
Your branch is up-to-date with 'origin/gh-pages'.

...


Delta compression using up to 4 threads.
Compressing objects: 100% (46/46), done.
Writing objects: 100% (46/46), 21.91 KiB | 1.15 MiB/s, done.
Total 46 (delta 42), reused 0 (delta 0)
remote: Resolving deltas: 100% (42/42), completed with 22 local objects.
To github.com:PyChina/blog.git
   82e099c..7954fee  gh-pages -> gh-pages
日  9 15 09:38:25 CST 2019

当前内置的运营指令:

༄  fab ?

Warning: Command(s) not found:
    ?

Available commands:

    build
    gh_pages
    pub
    reserve
    serve

main loop:

  1. git clone
  2. edit some .md in content/
  3. fab build for test local
  4. fab put7niu published all
  5. git add->ci->push

in fact because github only embded Jekll, but we r PyChina.org, so play with pure Python tools!

so, the site is generating in local, push into github, but be sync into pychina.qiniudn.com, publish as bind pychina.org ;-)

writing

  • fork https://gitcafe.com/CPyUG/PyChina into local

  • or becamed https://gitcafe.com/CPyUG member hold the repo. ACL

  • cd into content/

  • the sub-dir means:

      content/
          +- Events       首字母大写的是分类目录 收集对应文章
          +- Volunteer    ...志愿者
          +- _extra       扩展功能文件 e.g robots.txt
          +- _files       站内文件
          +- _images      样式图片
          `- pages        类似 about 的导航栏文档
    

文章格式

  • 标准 Markdown 格式

  • 以 .md 为后缀

  • 文件名不得使用中文/空格/符号

  • 内容模板:

    Title: 中E可以混杂的标题 Date: 2013-12-09 Tags: people, shanghai Slug: sting-chen Author: Zoom.Quiet

  • 其中:

注意:

  • 所有图片,应该事先发布到 7ni 空间中以便引用, 而不应该 push 到 git 仓库中
  • 参考: 我们是如何使用7牛云储存的
  • 自然的, 要加入协同编辑团队, 首先要获得 7niu 相关空间的配置文件
  • 获取流程:

deploy

支持本地调试! 使用 fabric 进行管理, 支持的命令:

fab 
Available commands:

    build       编译所有页面
    put7niu     本地完成编译,通过工具上传到 7niu
    reserve     重编译所有页面再启动本地服务
    serve       启动本地服务 localhost:8000

参考: qrsync 命令行同步工具 | 七牛云存储

design

基于 pelican-bootstrap3 深度定制

  • 配置: pelicanconf.py
  • 样式: _themes/pelican-bootstrap3/
  • 插件: _plugins/

changelog

  • 190818 ZQ ++ CNZZ WA support
  • 141120 增补文档,明确协同流程
  • 141119 upgrade as 3.5.0 base issue #264 fixed sitemap.py
  • 131218 base pelican build and through qiniu.com publish