Engine Yard

A step by step guide on how to install Django with PostgreSQL on Windows

Antonio Cangiano October 7th, 2006

This is a step by step tip about how to install Django with PostgreSQL on Windows. The links below point directly to the downloads, so the whole procedure should be extremely fast and easy.

  1. Install Python 2.5
  2. Install PostgreSQL 8.1.4
  3. Install the eGenix MX Base package
  4. Extract win-psycopg25.zip
    and copy libpq.dll and psycopg.pyd to c:\python25\DLLs (assuming c:\python25 is where you installed Python).
    You can test that the installation was successful by firing up python and trying: import psycopg. If you are not prompted with an error message, it simply worked.
  5. Get Django 0.95 and uncompress the tar.gz file. If you have problems with this, please use 7-Zip.
  6. If you don’t have setuptools already installed, the Django installation will download and install it for you.
    However the version that Django will attempt to download doesn’t exist on the server,
    therefore we need to specify a different one (the latest).

    Run:

    python ez_setup.py -U setuptools

    within the Django directory and this will install the latest setuptools for you. You can now go to step 7.

    Alternatively if you wish to install setuptools and Django in one step, open in your favorite editor, ez_setup.py located within the Django folder that you just uncompressed,

    and replace the line:


    DEFAULT_VERSION = “0.6c1”

    with

    DEFAULT_VERSION = “0.6c3”

    Now, if the Windows box you’re using has an Internet connection, you’re settle; otherwise just download this file manually into the Django folder.

  7. At this point, open a command prompt and run:



    python setup.py install

NOTE: While it is not recommended, if you wish to use Psycopg2 for some reason, you can skip steps 3 and 4, and use this installer instead.
Then you will need to specify in settings.py: DATABASE_ENGINE = ‘postgresql_psycopg2’ rather than ’postgresql’.


If you enjoyed this post, then make sure you subscribe to my RSS Feed.

  • Django , Quick Tips
  • Comments(5)

5 Responses to “A step by step guide on how to install Django with PostgreSQL on Windows”

  1. Dale AUSTRALIAon 07 Oct 2006 at 11:47 pm

    This page renders fine in Firefox, but is duplicated and overlayed on top of itself when viewed in Safari. Is this a Safari bug, or something non-standard with the page that Firefox handles?

  2. Mauricioon 09 Oct 2006 at 12:54 pm

    I attempted the install of Django following the Django documentation at Djangoprojec but I couldn’t have it work.

    Thanks, you just saved me an hour. Why can’t the Django documentation have this information in it?

  3. matt CANADAon 25 Oct 2006 at 4:06 pm

    what webserver would you use with this setup?

  4. Lorenzo CZECH REPUBLICon 07 Nov 2006 at 6:58 pm

    You’d use the one that comes with Django for development and lighttpd or apache for production

  5. XuanCris UNITED STATESon 08 Dec 2006 at 5:34 pm

    Fantastic! - everything worked as advertised except for the typos I made along the way.

    Nicely done, Antonio!

    http://www.powerslacker.com