Update: The content of this post is outdated. Please visit Old Wine in a new Bottle.
Lately I ran into some trouble adding a new post to our devops blog. So I decided to setup a virtual environment to avoid Python related problems in future.
If you are a casual pip user your might need to install pip first:
sudo easy_install pip
Install virtualenv itself:
$ pip install virtualenv
....
Installing collected packages: virtualenv
Successfully installed virtualenv
Cleaning up...
Create the new virtual environment:
$ virtualenv virtualenvs/pelican
New python executable in virtualenvs/pelican/bin/python
Installing setuptools, pip, wheel...done.
Activate the freshly created environment:
$ cd virtualenvs/pelican
$ . bin/activate
Within the new virtual environment install pelican
and markdown
packages as we are going to write the posts in Markdown.
(pelican)pelican> pip install pelican markdown typogrify
Change directory, start your local development server and verify the results continuously via autoreload at localhost...
(pelican)blog> pelican --autoreload -r input -o output -s pelicanconf.py
Side note: I got a:
Traceback (most recent call last):
....
raise ValueError, 'unknown locale: %s' % localename
ValueError: unknown locale: UTF-8
Thanks to the hint from Patrick I could track down, fix and verify this issue easily with:
(pelican)blog> export LC_ALL="en_US.UTF-8"
(pelican)blog> python -c 'import locale; print(locale.getdefaultlocale());'
('en_US', 'UTF-8')