Adding drag and drop image uploads to your Django site in 5 minutes with DropzoneJS

November 28, 2014

I've been using the Django admin to upload images to my site one-by-one for a few weeks now and I've finally decided I've had enough of it and started looking for a Javascript library that will enable me to do bulk uploads.

I still have around 100 or so albums and at least 1,000 more pictures to upload so you can just imagine how tedious that would be. I found this ...

Ubuntu users: How to upgrade the BIOS of your Dell XPS 13 Ultrabook

November 22, 2014

For a machine being sold with Ubuntu pre-installed, I find it surprising that Dell doesn't have a utility to make BIOS updates easy on Ubuntu.

Dell's BIOS update utility only runs on Windows or DOS.  So for us Ubuntu users, we'll need a way to run DOS on our machines and execute their update utility there.  Luckily, there's FreeDOS.

If you're having stability or performance issues, updating the BIOS is ...

How to disable the 'Invalid HTTP_HOST header' emails in Django

November 22, 2014

Ever get these annoying admin emails?

Invalid HTTP_HOST header: ''. You may need to add u'' to ALLOWED_HOSTS.

Request repr():
GET:<QueryDict: {}>,
POST:<QueryDict: {}>,
'HTTP_HOST': '',

The reason you're getting this is because someone's trying to access your site via a host not listed in your ALLOWED_HOSTS setting.  In my case, for this blog, I have ...

Migrating a Django app from MySQL to PostgreSQL

November 6, 2014

We just finished migrating the database for our Django 1.6 app from MySQL to PostgreSQL.  If you have a clean environment this process is as simple as running syncdb and/or migrate to create the tables, truncating the data in those tables, and running the dumpdata and loaddata management commands.  

Here are the steps to do this:

Step 1: Create an empty database in your PostgreSQL instance

CREATE DATABASE dbname OWNER rolename;

Step 2: Create a ...

New Blog Redesign: Now in Django 1.7!

November 1, 2014

I've finally gotten around redesigning my blog and making it more mobile friendly.  This is the third redesign for this blog since I started it back in January 2008.

I decided to completely redo it this time, moving away from the WordPress/PHP/MySQL stack to Django/Python/PostgreSQL.  Feels much cleaner and runs a lot faster.

Since I just wanted something simple, I wrote the backend myself instead of relying on existing Django apps ...

Docker Cleanup Commands

October 4, 2014

I’ve been working quite a bit with Docker these last few weeks and one thing that I found really annoying was all these unused containers and images taking up precious disk space.

I wish Docker has a ‘docker clean’ command that would delete stopped containers and untagged images. Perhaps sometime in the near future as the project is very active. But for the time being, these commands should do the job.

Kill all running containers

docker ...

How to delete Python .pyc and .pyo files on Ubuntu 14.04

September 2, 2014

I just realized today that Ubuntu has a command called pyclean already installed by default that will recursively delete all .pyc and .pyo files.

For example, to recursively delete .pyc and .pyo files from the current working directory, you can do:

pyclean .

If you’re not on Ubuntu, you can run this command instead:

find . -name “*.pyc” -delete