Date Tags tools

Quick and dirty steps I took to get Pelican going.

The Scenario

I needed to find a way to get content online. Inspired by Dave Tucker's article, I set out to use Pelican.


I started by creating a Centos 6.x VM, minimal install. Turns out that Pelican requires Python 2.7 or higher, and Centos 6.x comes with Python 2.6. So, you will need to get a newer version of Python. Good news here is that there is a handy link that gives us the stepping stones: Too much data:

yum groupinstall -y "Development tools"
yum install -y zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
yum install -y wget asciidoc

# Python 2.7.6:
tar xf Python-2.7.6.tar.xz
cd Python-2.7.6
./configure --prefix=/usr/local --enable-unicode=ucs4 --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
make && make altinstall

# Get the setup script for Setuptools:

# Then install it for Python 2.7:

# Now install pip using the newly installed setuptools:
easy_install-2.7 pip

# Install virtualenv for Python 2.7
pip2.7 install virtualenv

At this point, your system is ready to get Pelican going! Because of pip and virtualenv, you need not to be user root to get it going. Here are the steps, learned from Patrick Dubroy:

useradd foobar
su - foobar

virtualenv-2.7 ~/venv/pelican
source ~/venv/pelican/bin/activate
echo "source ~/venv/pelican/bin/activate" >> ~/.bashrc

pip install pelican
pip install Markdown
pip install typogrify
pip install Fabric

At this point, make your Pelican fly! Read up all about it at Pelican:

mkdir ~/site && cd ~/site

Welcome to pelican-quickstart v3.3.0.
This script will help you create a new Pelican-based website.

Please answer the following questions so this script can generate the files
needed by Pelican.

> Where do you want to create your new web site? [.] 
> What will be the title of this web site? test
> Who will be the author of this web site? foobar
> What will be the default language of this web site? [en] 
> Do you want to specify a URL prefix? e.g.,   (Y/n) 
> What is your URL prefix? (see above example; no trailing slash)
> Do you want to enable article pagination? (Y/n) 
> How many articles per page do you want? [10] 
> Do you want to generate a Fabfile/Makefile to automate generation and publishing? (Y/n) 
> Do you want an auto-reload & simpleHTTP script to assist with theme and site development? (Y/n) 
> Do you want to upload your website using FTP? (y/N) 
> Do you want to upload your website using SSH? (y/N) y
> What is the hostname of your SSH server? [localhost]
> What is the port of your SSH server? [22] 
> What is your username on that server? [root] 
> Where do you want to put your web site on that server? [/var/www] 
> Do you want to upload your website using Dropbox? (y/N) 
> Do you want to upload your website using S3? (y/N) 
> Do you want to upload your website using Rackspace Cloud Files? (y/N) 
Done. Your new project is available at /home/foobar/site

As far as publishing, I hit a little glitch when using Fabric. Here is the tweak I needed to do to the file:

(pelican)[foobar@test site]$ diff -u 
---   2014-04-30 08:17:26.682669968 -0400
+++        2014-04-30 08:23:04.160681733 -0400
@@ -22,14 +22,16 @@
         local('mkdir {deploy_path}'.format(**env))

 def build():
-    local('pelican -s')
+    ##BROKEN local('pelican -s')
+    local('pelican ./content -o {deploy_path} -s'.format(**env))

 def rebuild():

 def regenerate():
-    local('pelican -r -s')
+    ##BROKEN local('pelican -r -s')
+    local('pelican ./content -r -s')

 def serve():
     local('cd {deploy_path} && python -m SimpleHTTPServer'.format(**env))
@@ -39,7 +41,8 @@

 def preview():
-    local('pelican -s')
+    ##BROKEN local('pelican -s')
+    local('pelican ./content -s')

 def cf_upload():
@@ -51,7 +54,8 @@

 def publish():
-    local('pelican -s')
+    ##BROKEN local('pelican -s')
+    local('pelican ./content -o {deploy_path} -s'.format(**env))

Lastly, here is a link to where I keep all the source contents for this Pelican based site:


Good References


comments powered by Disqus