Blogofile Improvements

I finally got around to fixing a couple of minor annoyances I have with Blogofile. These fixes apply to the plugins development branch of Blogofile and the Blogofile_blog plugin, but they should be easily backport-able to the Blogofile master branch. I opened pull requests for these changes on Github and I'm happy to report that @EnigmaCurry merged the Blogofile_blog ones within hours! But since Blogofile development and this blog have been languishing for a while, I figured I should write about the changes here.

Using Python 2.7 and 3.2 with the PYTHONWARNINGS environment variable set to default reveals that both Blogofile and the Blogofile_blog plugin raise ResourceWarning exceptions when the blogofile build command is run. Admittedly, this is a really minor issue, but seeing a screen full of tracebacks every time I build my site is annoying, and it can obscure more serious problems. Those warnings are easily silenced by changing the offending open statements to use with statement context managers. The fix for Blogofile is in pull request 119 and the one for Blogofile_blog is in pull request 7.

The blogofile blog create post command creates a file with the extension .markdown by default but Blogofile also supports RST and Textile markup. I use RST and really want my newly created post files to have the extension .rst so that emacs goes to rst-mode automatically when I open a post file for editing. Again, a minor annoyance, and my fix was easily implemented. I chose to add a blog.post.default_markup config option. With blog.post.default_markup = 'rst' in my site's _config.py file my new posts get the .rst extension I want. If blog.post.default_markup is not set the created post file extension defaults to .markdown as before. This feature is in pull request 8.

I really like Blogofile and using it's plugins branch was my spur to get serious about using Python 3 and blogging again. So, I'm really happy to see @EnigmaCurry accepting pull requests again on the project. Hooray!!

Read and Post Comments

New Blog for Christmas

I decided to give myself a new blog for Christmas. All of my other blogs are based on b2evolution. It has served me well for years but I don't use much of its functionality, and hate dealing with its comment spam issues so much that I've turned off comments on all of those blogs. Most of all though, I want to use reStructuredText to write blog posts, just like I use it to write the vast majority of other content and docs that I create.

Blogofile caught my eye a while ago, not just because it easy supports reStructuredText markup, but also because:

  • it simplifies the blogging workflow to:
    • write in your favourite editor
    • build
    • upload
  • it gets rid of the overhead of a blogging app and database backend
  • it fits nicely into a version control workflow
  • it encourages delegation of comments, etc. (and the related spam issues) to Disqus

In for a Penny, in for a Python 3 Pound

There are lots of cool features in the development version of Blogofile, but running it requires Python 3. That's okay with me though because with all the libraries and frameworks that run under Python 3 now it's about time I started to use it for something serious.

A couple of observations:

  • I still have Python 2.6 set as my default version (for now), so that's what virtualenv runs under. But virtualenv -p python3 blogofile-dev happily built a Python 3 virtualenv for me to install Blogofile and its dependencies in. Is there no end to the awesome that virtualenv delivers?!
  • I installed Blogofile with python setup.py develop and noticed some pauses as the various dependency libraries were being installed in the virtualenv that were longer than what I'm used to when those libraries are installed under Python 2. My totally uninformed guess is that pauses were due to 2to3 being run in the libraries' setup.

So far I've had no need to touch Python code in the Blogofile context. It has all been Mako, HTML5, CSS and reStructuredText so far. Perhaps when I start to write a converter to migrate old posts from sadahome.ca/blogs/doug.php to here I'll have more to say on the differences between Python 3 and Python 2.

A Whole New Site, Actually

Blogofile is more than a blogging tool though; it's a static site builder. So, I took the opportunity to add some structure and style to the whole douglatornell.ca site. Migrating the content was easy, largely because it was already all in reStructuredText markup. The biggest time-sink was my attempt to create a new theme with a different colour scheme. Once again I was reminded at how badly I suck at the design aspect of web development. I settled for changing the title font to something that looks less like Comic Sans.

Things That Still Need to be Done

Updated 2011-12-29 20:52:51

  • Automate the process of pushing new content to Webfaction (affiliate link), either via a Mercurial hook, or a Fabric task, in contrast to the manual rsync command I'm using now Getting a Mercurial hook working turned out to be pretty easy.

Updated 2012-01-02 16:21:32

  • Use Disqus for comments Incredibly easy!
  • Migrate at least the Python-related content from sadahome.ca/blogs/doug.php
  • Convert the Nosy docs to Sphinx and move them to Read the Docs

Updated 2012-01-02 10:18:37

  • Add a Flickr badge to display a selection of my images in the sidebar Done, though the Flickr badge markup is pretty old and crufty looking, so I may revisit this to try to do something more modern using jQuery.
Read and Post Comments