Hosting multiple sites within a single Django project

Imagine we are running a successful online store for cat food (let's call it Since things are going so well, we would like to expand our business with a second store for dog food, Does this mean we'll have to set up a separate server even though the two stores will be very [...]

Spring-cleaning your (Arch) Linux system

Disclaimer: Some operations mentioned in this post are potentially destructive and irreversible. Be sure to back up all your important data before proceeding. Note: This post is written from the point of view of an Arch Linux user. Most steps presented below should nonetheless translate well to other distributions. Through the usual course of their [...]

Validating constraints across multiple form fields in Django

After all fields of a Django form have been validated in isolation, the Form().clean(self) method is called to conclude the validation process. This method is meant to house validation logic not associated with one field in particular. For example, let's suppose we have an application where our users can order gourmet-level cat & dog food. [...]

Where to define and instantiate associated models in Django

For the sake of example, let's consider the following UML diagram describing two model classes and how they are interrelated: We can see that there are two classes, User and UserProfile, with a one-to-one association between them. That is, each instance of class User is associated with one and only one instance of UserProfile and [...]

Streamlining radio buttons and checkboxes with CSS & Font Awesome

The appearance of radio buttons and checkboxes differs quite a lot between different browsers. Luckily, there are a number of ways to streamline the look of these input elements across browsers. One of them involves a combination of HTML, pure CSS and Font Awesome icons. HTML structure & icons The required HTML structure consists of [...]

Creating a persistent Arch Linux installation on a USB stick

I've been using Arch Linux for the better part of a decade now. As a result, I am so used to it that I'll choose it for nearly any task at hand. Although Arch might not be a traditional distribution for persistent live systems, there's really no reason to not use it to this purpose. [...]

Writing an ISO disk image directly from the Internet to a device

Disk images tend to be large yet available disk space remains a scarce resource even in times of multi-terabyte devices. For this reason, it can still be handy to retrieve a disk image from the Internet and write it to a device without having to temporarily store it on your disk. The below command will [...]

Building a Java JSON API in 4 minutes (yes, 4 minutes)

So you have written this amazing piece of software solving one of the world's biggest problems. If only you could quickly & painlessly share the fruits of your labor with the world… Well, actually you can, and it's not that hard. Quite the contrary: It's really simple, thanks to Spark1 which (according to its website) [...]

Adding type information to exported Scrapy items

By default, Scrapy won't include any type information when using feed exports to serialize scraped items. It follows that, when exporting multiple types of items at once, we later on can't easily discern between the different concepts represented by the items. Consider the following module: import scrapy class AnimalItem(scrapy.Item) name = scrapy.Field() class CatItem(AnimalItem) [...]