Notes and Thoughts

A New Blog!

December 03, 2012

Recently, I decided to move a new blogging setup. Previously, I used a self-hosted Wordpress install, then a custom Django app, and briefly Posterous.

I wanted a setup that:

I evaluated the following alternatives:

I eventually found this post by Nicolas Perriault about building a static site generator with Flask. The complete code is in one file and is pretty easy to understand and hack.

Using Boto, you could even easily publish directly to an AWS S3 bucket for direct hosting using S3.

To preview of your blog:

$ python site serve -d

This will run a local Werkzeug web server on http://127.0.0.1:5000/ serving all of your content.

To generate static HTML files from your posts:

$ python site build

This will put all static content into a ./build directory. Just upload to those files to your /var/www or wherever you want your static blog served from.

This setup has the following dependencies:

PIL and Fabric are really optional, but are helpful automation. Pygments is useful for automatic syntax highlighting of code snippets. I am pretty satisfied with how the setup has turned out so far.

Tags: python, blogging, static, site, generator, flask


comments powered by Disqus