November 19, 2015 will

Introducing Moya Techblog, a Blogging Engine for Coders and Photographers

I've had a blog on my vanity domain for nearly a decade now. For the last 6 years, it has been powered by Django Techblog, which I wrote out of my frustration with syntax highlighting plugins in Wordpress. Techblog has happily served my blog those 6 years, with only minor hiccups when I half-heartedly ported the code to the latest Django.

There was nothing terribly wrong with Django Techblog; it had multiple blogs, tags, search etc., but there were some annoyances that I didn't have the motivation to do much about. The custom markup system I used was clever, but I would often forget the syntax! The support for images was rudimentary and the single-threaded comment system wouldn't notify me of replies.

So fast forward 6 years and the time is right to build a new blog system to fix the old niggles. This time around I had same requirements for syntax highlighting in both posts and comments, with a new requirement to be able to manage and display photographs, while supporting the same multi-blog and feed URLs.

Moya Tech Blog

The new blog engine running my blog is Moya Tech Blog. Posts and comments use markdown (by default), which is practically a lingua franca for software developers.

The syntax highlighting supports a number of languages. Here's an example (my new favorite sort algorithm):

from time import sleep
from threading import Timer
 
def sleepsort(values):
    sleepsort.result = []
    def add1(x):
        sleepsort.result.append(x)
    mx = values[0]
    for v in values:
        if mx < v: mx = v
        Timer(v, add1, [v]).start()
    sleep(mx+1)
    return sleepsort.result

Post Editor

The editor in the old Techblog was undeniably clunky; just a big text-area. It did support drafts, and previews in a new window, but it wasn't at all elegant.

Moya Techblog's editor is friendlier. Drafts are auto-saved as you type, including any images you add, and there is an automatically updating preview that renders the markdown.

Photography Features

The original Techblog did nothing more than provide a basic UI for uploading images. The new, friendlier, interface manages uploads and does some some fairly sophisticated image processing so that photos are displayed in a resolution that fits the display. If you upload large enough photos, it will display them in pin-sharp 4K resolution on high dpi and retina displays. I don't think that even 500px supports that.

Moya Techblog Image manager

A feature that I think photographers will appreciate is that Moya Techblog will extract camera and lens information from the exif data (here's an example). I've always found this information invaluable, especially when I was learning photography.

Installing Moya Techblog

Moya Techblog is super easy to install. First install the following with pip (requests_oauthlib is for the 'Sign-In with...' buttons):

pip install moya requests_oauthlib

Next run the following to get the code and set up the database:

git clone https://github.com/moyaproject/moya-techblog
cd moya-techblog/site
moya init

From the same directory, enter the following to run the development server:

moya runserver

The development server uses sqlite and stores media in the project directory, which is convenient for testing/development. See the docs on deployment if you want to permanently host Moya Techblog.

Use Markdown for formatting
*Italic* **Bold** `inline code` Links to [Google](http://www.google.com) > This is a quote > ```python import this ```
your comment will be previewed here
gravatar
COLABORATI

does this blog provide any features regarding responsive images?

gravatar
Will McGugan

It does. It renders a number of different images sizes and will pick the most approriated size to fit window dimensions / pixel ratio. See this post as an example.