<!-- 
.. title: Install a python-based blog
.. slug: install-a-python-based-blog
.. date: 2014-12-31 17:34:40 UTC
.. tags: linux, web, presentations
.. link: 
.. description: 
.. type: text
-->

Here's one way to install a python-based blog such as Nikola. In principle, it's the same procedure as documented in [a previous post](i-dau.html), but I understand it better this time.

First, install the essential ingredients to create a virtual environment for python and friends and handle it in a convenient fashion:

	sudo pacman -S python-virtualenv python-virtualenvwrapper 
	
Second, create the virtual environment, install Nikola and all other things you need. 

	mkvirtualenv nikola
	pip install Nikola
	pip install requests
	pip install livereload
	pip install jinja2
	pip install markdown
	pip install webassets
	
If you don't know what you need:

	pip install Nikola[extras]

	
Third, initialize your blog and install some plugins:

	nikola init pdes-net.org
	cd pdes-net.org/
	nikola install_theme bootstrap /or any other/
	nikola plugin -i localsearch
	nikola plugin -i tags
	
Fourth, create a new post:

	nikola new_post
	
Edit the new post with your favorite editor!

Fifth, after saving the new post, build and serve it:

	nikola build && nikola serve
	
You can examine the result under http://localhost:8000.
ALternatively, you can use 

	nikola auto
	
to be able to edit the post in quasi real-time. When you are satisfied, you can sync the result to your webspace using

	nikola deploy

After all this work, you may have got tired of the whole business. Get out of it:

	deactivate nikola
	
To start working again, issue 

	workon nikola

After a while,the whole machinery in your virtualenv is in dire need to be updated. How to do that? The easiest way is:

	workon nikola
	pip install pip-tools
	pip-review --interactive
	
pip thus becomes a veritable package manager in its respective virtualenv. Not too bad.
