Techblog Posts

9 posts tagged with techblog

This SO post prompted me to think about how you would go about customizing a entire Django site (not just an app). Particularly if it is a third party project, still in development.

Forking the site repository is a solution, but the more customizations you make, the more awkward it becomes to merge upstream fixes and features. The problem is compounded if you have multiple deploys, with custom templates, assets, and settings.

I wanted to do a quick write-up of how this would be done in Moya, where customization is more of a first-class concept.

I'll briefly go over how you would serve a Moya site with a custom template, without modifying any of the original files. The project I'll be customizing is Moya Techblog which power this blog. continue reading…

I spent an evening adding 'progressive' loading of the title images to my blog.

The title images for this blog are 3840 × 2160 and a hefty ~650K each. That's entirely intentional; as a photographer I wanted them to look as sharp as possible and take advantage of high pixel density screens.

The only downside of hi-res photos is that even with a good internet connection, you can still see the photo loading as the browser reads the JPEG. It's visually jarring and way too reminiscent of the web, circa 2000s.

A reasonable solution is to first download a smaller lower-resolution version, then load the full resolution image on top of that. So the user sees something relatively quickly, without the visual contrast of an image loading on a blank background. continue reading…

A quick way to get Moya Techblog up and running (or just to test it) is to deploy it with Heroku.

If you click the following button, it will deploy Techblog on a public server:

When that's done you should have a working version of this site (sans my content obviously). It's remarkably easy to customize if you aren't happy with my coder design skills.

There is one caveat you should be aware of; Heroku has an ephemeral filesystem, which basically means that your uploaded files will disappear after a while. That is bit of a deal-breaker for a site designed for photography, but there is a solution. You can host your uploads with Amazon S3.

To use Amazon S3 with Techblog, set the following environment variables (you will have a chance to edit these when you deploy): continue reading…

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. continue reading…

I figured I would write-up some of the features of Django Techblog, the blogging application I wrote to power this site. It does most of what you would expect from a blogging app, but there are a few features that it does differently. The main difference is extended markup, but there are a couple of other features that worthy of note:

The code for Django-techblog is licensed under my politeware license, which means you can use it for any purpose you see fit, but I would appreciate a thank you! It shouldn't be too difficult to set-up if you have worked with Django, but I'd be happy to help if you experience any problems with it. See the Google Code page for the SVN url:

http://code.google.com/p/djangotechblog/

I've been toying with optimizing the caching on my blog recently – for my own interest (this humble blog doesn't get all that much traffic). All the same, any speed improvements will only mean snappier page-loads and greater capacity to handle a slashdotting, or similar.

I discovered that Nginx has a memcached module that can serve pages directly from memcached without touching the file-system, or a downstream web-app. Which makes for very fast response times. To get it working, you need to set a cache key named with the url of the page, and the value to the HTML. Alas, this means that it would not work with Django's caching mechanism due to the way Django caches unique pages based on the contents of the request header. continue reading…

In my last post I introduced extended-markup, which is the light-weight markup system used to generate posts in Django-Techblog. I'll cover a few other things it can do in this post.

When the Post model is saved to the database, the extended markup is parsed in to a structure that is basically a dictionary containing a list of chunks, and associated variables. The order that the chunks appear in each section is the same as the order they appear in the markup, unless a chunk variable called priority is defined. This causes the chunks to be sorted in descending order of priority, chunks without a priority value are assigned a default of 100.

Here is an example of two chunks with a priority value assigned: continue reading…

Django Tech Blog is now running my blog. It is only fitting that my first post on the new system is about the technology behind it.

I never intended to compete with Wordpress on number of features, and Techblog was never intended to be an all-things-to-everyone type of web application, but I can boast a few features that set it apart. I'll cover some of those features in future posts, for now I would like to go over the light-weight markup language I use for posts. continue reading…

Please test the comment system on this post. Django Techblog was build for my own needs to be able to easily display code in posts and to allow readers to insert code in to comments without linking to external sites.

To insert code in to a comment use the [code] tag, you may optionally supply a language to syntax highlight the pasted code. For example [code python]import this[/code] should produce something along the following lines:

Some other tags you can use are: [b] [i] [s] [size] [url] [quote]

To get things started, lets pretend we are discussing the following piece of code which is in use in this blog, and is used to send out mails when a comment is made. The decorator is my version of Django's signals, which I will probably blog about at some point!