用 Pelican 打造你的个人主页一

Posted on Sun 05 April 2015 in minute

1. install brew

这里仅以 mac book 为例,在windows上差不多,先把python, pip装上,剩下的就好办了

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

2. install python, pip and pelican

brew install python
sudo easy_install pip
sudo pip install pelican markdown
output: ::
Successfully installed blinker-1.3 docutils-0.12 feedgenerator-1.7 jinja2-2.7.3 markdown-2.6 markupsafe-0.23 pelican-3.5.0 pygments-2.0.2 unidecode-0.4.17

3. execute: pelican-quickstart in yoursite folder

pelican-quickstart
  • Problem1:some errors showed up: ValueError: unknown locale: UTF-8 * Solution:

  • add some lines to your ~/.bash_profile:

    export LC_ALL=en_US.UTF-8
    export LANG=en_US.UTF-8
    
  • Problem2: No module named html_parser
    • solution: pip install six
      • if still encounter the error , upgrade python form 2.7.6 to 2.7.9

      • if still encounter the error:

        sudo vi /Library/Python/2.7/site-packages/pelican/readers.py
        #from six.moves.html_parser import HTMLParser
        from HTMLParser import HTMLParser
        

4. add a article test.md in content folder

Title: Journal
Date: 2015-02-27 10:20
Modified: 2015-02-27 19:30
Category: Journal
Tags: journal, blog
Authors: Walter Fan
Summary: Daily minute

# Task

5. quick test as the following steps

pelican content
cd output
python -m SimpleHTTPServer

6. access http://localhost:8000

可见一个象模象样的博客网站已经生成了

Tips

  • edit pelicanconf.py to set RELATIVE_URLS = True