Detailing all the fun I’m having setting up Pelican.

After I get this part working, I’m going back to themes. Then I have to figure out how to import my wordpress posts.

Initially, this was all done on a OS X Yosemite machine. Later on, I migrated to El Capitan (beta). Thus far, its all worked fine. Shouldn’t matter, but YMMV.

Installing python

Start by installing python (I started out with python3, but I found that not all packages work properly with python3 - Does anybody understand backwards compatibility?). I also wanted to build python with the openssl pkg from homebrew.

Next we use pip to install virtualenv (keeps our python versions seperated until the packagers figure out how to do it properly)

Create a path to where you want your virtualenv to exist. Then run the virtualenv command with the -p python argument. Its true that is the default, but at some point that may change to become python3 and we don’t want to be caught unawares.

mkdir -p ~/path/to/pelican/Virtualenv
cd ~/path/to/pelican/Virtualenv
virtualenv -p python Pelican-Dev

Bash configuration

Next, we will edit our .bashrc. We want to restrict the ability to use pip outside of virtual environments (this keeps us from modifying the global/system packages, and additionally, ensures that the packages we install are in the virtual environment(s), where they belong).

The bashrc section looks like this:

## pip should only run if there is a virtualenv currently activated
export PIP_REQUIRE_VIRTUALENV=true
## cache pip-installed packages to avoid re-downloading
export PIP_DOWNLOAD_CACHE=$HOME/.pip/cache

syspip () {
	PIP_REQUIRE_VIRTUALENV="" pip "$@"
}

Evaluate the changes in your .bashrc

Use the syspip command to install/upgrade the pip, setuptools, and virtualenv pkgs. For now, this is all we want at the global/system level. Everything else belongs in the virtual environment.

Virtualenv

Navigate to the place we will create our pelican virtual environment. Then run virtualenv and pass an argument that is the name of the environment. I chose pelican (I’m known for my creativity).

cd ~/path/to/pelican/Virtualenvs
virtualenv pelican

Navigate to the new environment. Evaluate the script bin/activate, as shown. Your prompt should now suggest that you are in the environment you just created. My prompt begins with a (pelican).

cd pelican
. bin/activate

Now that we are in our virtual environment, we can use pip to install pelican, markdown, typogrify and any other bits (I’ve included some things that should be covered as dependencies and auto-pulled, but just in case…):

(pelican)[louisk@iPwn pelican ]$ pip install markdown typogrify pelican beautifulsoup4 feedgenerator jinja2 pygments docutils pytz blinker unidecode six Markupsafe python-dateutil pillow
	Collecting markdown
	Downloading Markdown-2.6.2-py2.py3-none-any.whl (157kB)
		100% |████████████████████████████████| 159kB 281kB/s
	Collecting typogrify
	Downloading typogrify-2.0.7.tar.gz
	Collecting pelican
	Downloading pelican-3.6.0-py2.py3-none-any.whl (525kB)
		100% |████████████████████████████████| 528kB 652kB/s
	Requirement already satisfied (use --upgrade to upgrade):
	beautifulsoup4 in ./lib/python.4/site-packages
	Collecting feedgenerator
	Downloading feedgenerator-1.7.tar.gz
	Collecting jinja2
	Downloading Jinja2-2.7.3.tar.gz (378kB)
		100% |████████████████████████████████| 380kB 618kB/s
	Collecting pygments
	Downloading Pygments-2.0.2-py3-none-any.whl (672kB)
		100% |████████████████████████████████| 675kB 272kB/s
	Collecting docutils
	Downloading docutils-0.12-py3-none-any.whl (508kB)
		100% |████████████████████████████████| 512kB 570kB/s
	Collecting pytz
	Downloading pytz-2015.4-py2.py3-none-any.whl (475kB)
		100% |████████████████████████████████| 475kB 634kB/s
	Collecting blinker
	Downloading blinker-1.3.tar.gz (91kB)
		100% |████████████████████████████████| 94kB 1.4MB/s
	Collecting unidecode
	Downloading Unidecode-0.04.18.tar.gz (206kB)
		100% |████████████████████████████████| 208kB 969kB/s
	Collecting six
	Downloading six-1.9.0-py2.py3-none-any.whl
	Collecting Markupsafe
	Downloading MarkupSafe-0.23.tar.gz
	Collecting python-dateutil
	Downloading python_dateutil-2.4.2-py2.py3-none-any.whl (188kB)
		100% |████████████████████████████████| 192kB 24kB/s
	Collecting smartypants>=1.8.3 (from typogrify)
	Downloading smartypants-1.8.6-py2.py3-none-any.whl
	Building wheels for collected packages: typogrify, feedgenerator, jinja2, blinker, unidecode, Markupsafe
	Running setup.py bdist_wheel for typogrify
	Stored in directory:
	/Users/louisk/Library/Caches/pip/wheels/5c/8d/1a/f43724fb740e9fa3b59ec240b4eb7ebc9d4f6902f736aacba9
	Running setup.py bdist_wheel for feedgenerator
	Stored in directory:
	/Users/louisk/Library/Caches/pip/wheels/13/ec/29/50c8c019310746a1dc184553a3c78ca2ec5117494381555eb7
	Running setup.py bdist_wheel for jinja2
	Stored in directory:
	/Users/louisk/Library/Caches/pip/wheels/b3/c0/62/8908d15b90a7de8bd15e2e6e5f5ba1398c0d9940d62a6bf8f5
	Running setup.py bdist_wheel for blinker
	Stored in directory:
	/Users/louisk/Library/Caches/pip/wheels/50/80/79/716f1148d4a8f868755b05259988deccce37edbfb195ded724
	Running setup.py bdist_wheel for unidecode
	Stored in directory:
	/Users/louisk/Library/Caches/pip/wheels/a8/85/b6/71cbccded974d5a8e15cbe7d22066d87f34329d98c7ed5d786
	Running setup.py bdist_wheel for Markupsafe
	Stored in directory:
	/Users/louisk/Library/Caches/pip/wheels/94/a7/79/f79a998b64c1281cb99fa9bbd33cfc9b8b5775f438218d17a7
	Successfully built typogrify feedgenerator jinja2 blinker
	unidecode Markupsafe
	Installing collected packages: markdown, smartypants, typogrify, six, pytz, unidecode, blinker, feedgenerator, Markupsafe, jinja2, python-dateutil, docutils, pygments, pelican
	Successfully installed Markupsafe-0.23 blinker-1.3 docutils-0.12 feedgenerator-1.7 jinja2-2.7.3 markdown-2.6.2 pelican-3.6.0 pygments-2.0.2 python-dateutil-2.4.2 pytz-2015.4 six-1.9.0 smartypants-1.8.6 typogrify-2.0.7 unidecode-0.4.18
(pelican)[louisk@iPwn pelican ]$

If you want to use the ‘assets’ plugin for pelican, make sure you install the webassets bits with pip.

(pelican)[louisk@iPwn pelican ]$ pip install webassets
	Collecting webassets
	Downloading webassets-0.10.1.tar.gz (167kB)
		100% |████████████████████████████████| 167kB 83kB/s
	Building wheels for collected packages: webassets
	Running setup.py bdist_wheel for webassets
	Stored in directory:
	/Users/louisk/Library/Caches/pip/wheels/65/7a/b4/7ef714f1017ea993a1815e61dd334f6195c3d0aadbb2710a55
	Successfully built webassets
	Installing collected packages: webassets
	Successfully installed webassets-0.10.1

The list of python plugins I’m currently using is

beautifulsoup4
blinker
blockdiag
blockdiagcontrib-cisco
blockdiagcontrib-class
blockdiagcontrib-excelhogan
blockdiagcontrib-excelshape
blockdiagcontrib-labeledbox
blockdiagcontrib-square
blockdiagcontrib-tex
docutils
feedgenerator
funcparserlib
jdcal
Jinja2
Markdown
MarkupSafe
microdata
nwdiag
openpyxl
pelican
Pillow
pip
Pygments
python-dateutil
pytz
setuptools
seqdiag
six
smartypants
typogrify
Unidecode
virtualenv
webassets
webcolors
wheel

Plugins and themes

Now we can get to creating the site we’ll use for pelican I dumped mine into the current directory. I made git clones of the pelican-themes and pelican-plugins directories. Then I copied things around as appropriate, anytime I wanted to make changes to something.

Pelican docs

The docs for setting up pelican are here If you’ve followed the instructions above, you can skip the part about installing pelican, that’s already done. You can jump in with creating a directory for your site, and from that directory, running:

This will create a skeleton collection of files you can start working with including a development “web server” so you can create your new site and see what it will look like.

Development server

The development web server is nice, but I will point out that there can be times when it doesn’t log what its doing, and you have to do something arcane like watch the CPU to know when its done. If you try to view the site (in your browser) before that, you will get lots of errors that don’t make sense. Once the server has finished regenerating everything, things go back to normal.

Moving forward

Now the easy part is done. Its time to start working on the custom bits. You can start digging around in the theme to play with the templates, and the css to get the look you want. You can also look at the plugins. Frequently you will need to modify the templates to take advantage of plugins.