== Development (Mac OS X Tiger) == Originally written by [http://www.benatkin.com/ Ben Atkin] These instructions are for Django 0.91. I hope to update this with most new releases. I prefer the latest tarballs for general development. If I ever start to get really into the software I get the CVS or SVN. '''Before beginning''', install XCode. XCode contains make, gcc, and other things you'll be needing when compiling from source. ''As an alternative to these instructions, consider installing [http://darwinports.opendarwin.org/ DarwinPorts]. It simplifies installing up-to-date versions of apache2, python 2.4, mod_python, PIL, and the various databases that Django supports''. === Installing Python === 1. Download and unpack latest stable python tarball 1. {{{./configure --prefix=/opt/python; make; make install}}} 1. Add {{{export PATH=/opt/python/bin:$PATH}}} and {{{export MANPATH=/opt/python/man:$MANPATH}}} to {{{~/.profile}}} 1. Open a new terminal session 1. Type {{{python}}} and check that it is the version you just installed === Installing PostgreSQL === 1. Create a new user, ''postgres'' in the Accounts Pane of the Mac OS X System Preferences 1. Download and unpack latest stable PostgreSQL tarball 1. {{{./configure --prefix=/opt/pgsql; make; sudo make install}}} 1. Add {{{export PATH=/opt/pgsql/bin:$PATH}}} and {{{export MANPATH=/opt/pgsql/man:$MANPATH}}} to {{{~/.profile}}} 1. Add {{{export PGDATA=/opt/pgsql/data}}} to {{{~/.profile}}} '''NOTE: If this isn't set, ''postgres'' will complain about a missing conf file.''' 1. Open a new terminal session 1. Type {{{psql -V}}} and check that it is the version you just installed 1. Create a data directory: {{{sudo mkdir $PGDATA}}} 1. Change ownership to postgres: {{{sudo chown postgres:postgres $PGDATA}}} 1. Create the initial data area: {{{sudo -u postgres initdb -D $PGDATA}}} '''NOTE: {{{sudo}}} means ''substitute user and do'', and in this case with the initial {{{-u}}} parameter, we are telling sudo to run the command as ''postgres'' rather than ''root''.''' 1. To run the database (will not be automatically started on boot): {{{sudo -u postgres pg_ctl start}}} 1. Open a new window, and type {{{sudo -u postgres createdb test}}}. If it says {{{CREATE DATABASE}}}, it's working. :) === Installing psycopg (PostgreSQL Bindings) === At the time of this writing, the only stable version of ''psycopg'' is ''psycopg1''. The development version ''psycopg2'' is not supported by Django. 1. Download the latest stable tartball of ''[http://www.egenix.com/files/python/mxDateTime.html mxDateTime]'' 1. Unpack the tarball and go into the directory 1. {{{python setup.py build}}} 1. {{{sudo python setup.py install}}} 1. {{{Download the latest stable tarball of psycopg1}}} 1. {{{export MACOSX_DEPLOYMENT_TARGET=10.4}}} 1. {{{export CPPFLAGS="-I/opt/python/lib/python2.4/site-packages/mx/DateTime/mxDateTime"}}} 1. {{{./configure --with-postgres-libraries=$(pg_config --libdir) --with-postgres-includes=$(pg_config --includedir)}}} 1. {{{make}}} 1. {{{sudo make install}}} 1. Run {{{python}}}, type {{{import psycopg}}} into the interactive read-eval-print loop (REPL), and {{{quit}}} the REPL.