Django on Debian Squeeze with Postgres
Here are my notes for getting Django set up on Debian Squeeze with Postgres as the database. System was a new virtual machine running on VMWare Fusion.
Install dependencies for psycop2 and postgres:
sudo apt-get install python-dev libpq-dev postgresql python-django
Download and install psycopg2 (path will change – check – http://initd.org/psycopg/download/)
wget http://initd.org/psycopg/tarballs/PSYCOPG-2-4/psycopg2-2.4.4.tar.gz
tar -xvf psycopg2-2.4.4.tar.gz
cd psycopg2-2.4.4/
sudo python setup.py install
Add a user and database in postgres:
su - postgres
CREATE DATABASE djangotest;
CREATE USER django WITH PASSWORD 'django';
GRANT ALL ON djangotest TO django;
Run django-admin.py startproject mysite as per the tutorial website to get started.
In settings.py I had to specify localhost as the database machine – they comments say this isn’t needed.
So in settings.py the database section will look similar to this (I have changed the password…):
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'djangotest', # Or path to database file if using sqlite3.
'USER': 'django', # Not used with sqlite3.
'PASSWORD': 'django', # Not used with sqlite3.
'HOST': 'localhost', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '', # Set to empty string for default. Not used with sqlite3.
From there you should be good to go with the tutorial.


Sometimes living in a foreign country can be heaps of fun, and sometimes it can be a pain.