Thursday 26 January 2012

Flask & Speed.

Update June 2012 : The site is now once again running on Django because as nice as Flask is, I'm faster with Django.

This site is now running on Flask and hosted with webfaction on one of their Amsterdam machines. This is departure from the previous version which was running on Django and hosted on a Zerigo VPS.

Why Change?

I was really geared up to make this site a static site. I wanted to get away from having a stack dynamically processing content that hardly ever changed. I wanted to have a fast site. I wanted to be able to write in a writing application, not a textarea.

A statically generated site seemed like the right choices. I tried Hyde, Jeckyl and Nanoc; none hit the sweet spot. Hyde (python) is still in development, so the docs where a little thin, so eventually I gave up on it. Jeckyl and Nanoc (both ruby) are both fine pieces of software, but they just didn’t do it for me.

Enter Flask

I thought about it, I was really after speed. Static was just the means of getting there. I came to the conclusion that I didn’t care about how I got speed, as long as I got it. So I set about building a flask application that didn’t use a database - it just reads markdown files. That application is what you see before you and it’s cached up to the hilt using memcache. You can peruse the source code on github