Give a try to Pelican

It seems in one night all geeks have their own Github User Page and Octopress Blog. Like everyone posted in their blogs, Static Blog is indeed more convenient than traditional Blog systems such as WordPress. I have been wanting my own Octopress since then.

But it seems that Octopress isn't for me

At first I was confused by Setup Steps of Octopress . What is this RVM thing? And what is that rbenv thing? It seems the high pace of Ruby community has beyond my imagination to a degree that they need a version manager to ensure the compatibility of different versions of Ruby. Althrough the same compatibility issue also troubles Python community [1] , but at least Python don't need a version manager (yet) to control this mass [2] .

Real problem for me is that I haven't yet a Linux box that I can play around freely. (I really want one ... ) Both RVM and rbenv needs to run on Unix/Linux/MacOSX. One can not be a geek if he use Windows ? (Maybe it's true...)

Remaining problem is the battle between Ruby and Python campaign. I haven't tried Markdown , and I rather like ReST . It seems that both sides depend on Pygments as code block highlighter so Rubyists need Python environment anyway. I simply don't want to depend on any Ruby component. It is better when it is in pure Python, no C extensions so that I can debug into it and make minor modifications.

So I started searching for Static Blog Engine in Python on Github. The author of the great framework Flask , mitsuhiko , wrote a rstblog , but it's not well developed. Hyde seems to be complete enough, but it use MarkDown as its default markup language, and the design of its homepage is too fashion to be used as blog. Finally I found Pelican .

[1]Such as the difference between Python 2.x and 3.x , and also difference in C-API of implementations of PyPy , CPython , Stackless , Cython .
[2]Yes, we have easy_install and pip , but all these are package manager, running in a perticular Python implementation. Python implementation itself don't need a manager. Version issue of Python largely have been solved by lightweight converters such as 2to3.py and 3to2.py , you don't need to store multiple implementations of Python in your disk for different packages. Yes you can use virtualenv if you need to preserve stablility but this is another story.

Let it be Pelican

For my own use, Pelican offers me some advantages over Octopress:

  1. Implemented in pure Python. This means that I can use different implementation of Python other than CPython easily. I use PyPy myself.
  2. Translation of multi-languages. The original author of Pelican is a France. This is unnecessory for most people, but I will post my blog mainly in three languages: English, Japanese and Chinese.
  3. ReST . So that I can use the @auto-rst feature of Leo . And also I don't need to switch between my blog and documentation of my projects.

But it seems that Pelican was less contributed than Octopress . Some minor issues remains in latest version:

  1. Support of pelican-import from WordPress for Chinese and Japanese articles are buggy.
  2. Datetime format, timezone, and locale support for multi-language blogs are not so natural. I will work on this in these days
  3. There are not so many templates compared to Octopress .
  4. And less plugins .

I hope more people from Python community can contribute to this excellent project, then all these issues will be fixed soon.

My settings

To install Pelican is simple:

$ pip install pelican

Write posts in ReST , with


rst
extensions, and put them in

pages
folder. (Re)Build all pages is simply:

$ pelican -s settings.py

Push to Github:

$ git commit -am "Commit message"
$ git push

And following is my


settings.py
:

# -*- coding: utf-8 -*-

TIMEZONE = 'Asia/Tokyo'

DATE_FORMATS = {
    'en':('usa','%a, %d %b %Y'),
    'zh':('chs','%Y-%m-%d, %a'),
    'jp':('jpn','%Y/%m/%d (%a)'),
}
# windows locale: http://msdn.microsoft.com/en-us/library/cdax410z%28VS.71%29.aspx
LOCALE = ['usa', 'chs', 'jpn',        # windows
          'en_US', 'zh_CN', 'ja_JP']  # Unix/Linux
DEFAULT_LANG = 'zh'

SITENAME = 'Farseerfc Blog'
AUTHOR = 'Jiachen Yang'

DISQUS_SITENAME = 'farseerfcgithub'
GITHUB_URL = 'https://github.com/farseerfc'
SITEURL = 'http://farseerfc.github.com'
TAG_FEED  = 'feeds/%s.atom.xml'

SOCIAL = (('twitter', 'http://twitter.com/farseerfc'),
          ('github', 'https://github.com/farseerfc'),
          ('facebook', 'http://www.facebook.com/farseerfc'),
          ('weibo', 'http://weibo.com/farseerfc'),
          ('renren', 'http://www.renren.com/farseer'),
          )


TWITTER_USERNAME = 'farseerfc'

THEME='notmyidea'
CSS_FILE = "wide.css"

DEFAULT_CATEGORY ='Others'
OUTPUT_PATH = '.'
PATH = 'posts'

This is part 1 of the "pelican" series:

Leave a comment from this post's issue page using your Github account.
comments powered by Disqus