Cameron Lane

Erstwhile educator. Python programmer.

Building This Site

Why I Built This Site

I have used several different blogging platforms, but they all left me feeling unsatisfied. The big popular systems like blogger and WordPress are supposed to make publishing WYSIWYG easy. For the most part that is true, but there is a lot of overhead, for lack of a better term, with these systems.

First, there is the time involved in keeping plugins up to date, approving/denying comments (99.999% of which seem to be spam). In terms of total time spent, it is probably not a huge time commitment, but it is annoying. Secondly, there is the overhead involved in actually serving a dynamic site, overhead incurred by your readers. This comes in the form of database access and a host of other things that have to happen to serve a site dynamically. Primarily it was these two factors that sent me searching for simpler alternative. Ultimately, I settled on generating a static site using Python, Flask, Frozen-Flask.

How I Built This Site

This site is based heavily on the work of @n1k0, a French programmer who has taken great pains to open source all of the code for his python- and Flask-based static blog generator. His tutorial and code were a great starting point for me. I want rehash all the great work he has done there. If your interested, go read the tutorial and his code.

Here are the steps I followed. I took the tutorial on Nicolas' blog, compared it with his published code, and hacked on it until I thought I understood how it worked. Then I adjusted it to better suit my needs. Inevitably, I ran into problems (e.g., if you're getting a MissingURLGenerator warning when "freezing" your site, you'll need to adjust your Jinja templates to use the url_for command), but really that just forced me to look up documentation for Flask or Jinja. In the end, I have a much better understanding of the way these tools work.

There is still a lot of this site that has the look and feel of @n1k0's blog. For example, I have blatantly stolen all of the design and layout portions of his site. Additionally, the static generation part of this blog is nearly identical to his. Luckily, Nicolas has placed his code under a very permissive license. I think that this is exactly what he wants people to do with his code - it's how open source works. Anyway, I have learned a great deal about python, Flask, and a load of other technologies through this process. Thanks to Nicolas for allowing me the opportunity!

Returning the Favor

As a way of 'paying-it-forward', I will make the code for my static generator available as well. You are free to use any or all of the code as you see fit. Hope that it helps you learn something.

comments powered by Disqus