Skip to content

tech

Setting up Django with Nginx, Gunicorn, virtualenv, supervisor and PostgreSQL

Django is an efficient, versatile and dynamically evolving web application development framework. When Django initially gained popularity, the recommended setup for running Django applications was based around Apache with mod_wsgi. The art of running Django advanced and these days the recommended configuration is more efficient and resilient, but also more complex and includes such tools as: Nginx, Gunicorn, virtualenv, supervisord and PostgreSQL.

In this text I will explain how to combine all of these components into a Django server running on Linux.

Running Drupal on Nginx with Memcached

Drupal is a great CMS system for deploying websites quickly and managing them easily. Traditionally Drupal was run on a LAMP stack, but this configuration does not necessarily offer the best performance for the system. These days you can squeeze more performance out of Drupal by running it on a LEMP (Linux-Nginx-MySQL-PHP) stack in which Apache is replaced by the Nginx reverse-proxy. Further performance improvement can be gained by hooking up memcached to handle cacheing. This article explains how you can prepare a professional LEMP server for your Drupal sites.

How to turn shell commands into Mac OS X services

OS X has a nice functionality called services which allow you (and applications you install) to expand the functionality of your system by adding commands, which will be visible in a special menu. Services may also be available in contextual menus, for instance when you right-click on a file or folder in the Finder.

Services menu in Finder

Check Google Analytics unique visitors from Python

You may want to check your Google Analytics data programmatically. This allows you to write some logic around your analytics data, such as sending e-mails in certain situations or just providing a status update for you to inspect without the hassle of logging into your account with a browser.

For a simple example, I use a utility called GeekTool to display certain information, such as incoming email, directly on my desktop for quick reference. I decided to also display updates of my Analytics profiles in this way, displaying a daily summary of unique visitors for each site I monitor. The end result looks like this:

Google Analytics unique visitor counters displayed by GeekTool

How to run multiple websites from one Django project

It is sometimes beneficial to run two or more web sites or subdomains of a site from a single Django code base. Each Django app in the project can then power a website on a different domain, but all the apps can still share a single database with a single administrative interface.

Browser usage statistics - past, present and future

Every web developer knows this story... Microsoft arrived late to the Internet party, but they huffed and they puffed... and they bundled their browser in with their dominating OS... and they blew down the house which Netscape built. After this, they congratulated themselves for winning the Browser wars and proceeded to sit on their laurels for over half a decade.

My informative shell prompt

The Bash shell prompt in your Terminal is very highly customizable and can display a wide variety of useful information. This is what my prompt looks like and how to create it.

[09:10:11] user@host ~/Desktop +

mdadm GUI - A graphical interface to Linux software RAID via Webmin

Anybody who cares about their data understands, that data "is not safe, unless it exists in at least two copies". This redundancy can be achieved by keeping various backups, but it's clear that the only backup scheme which works is the "set it and forget it" kind. If you are technical enough to build your own NAS, or if you run Linux on your desktop, you probably know about RAID, fake RAID, and software RAID. Using RAID makes your backup strategy completely transparent and your data safe and happy.