Version 16 (modified by 19 years ago) ( diff ) | ,
---|
Development (Mac OS X Tiger)
Originally written by 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 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
- Download and unpack latest stable python tarball
./configure --prefix=/opt/python; make; make install
- Add
export PATH=/opt/python/bin:$PATH
andexport MANPATH=/opt/python/man:$MANPATH
to~/.profile
- Open a new terminal session
- Type
python
and check that it is the version you just installed
Installing PostgreSQL
- Create a new user, postgres in the Accounts Pane of the Mac OS X System Preferences
- Download and unpack latest stable PostgreSQL tarball
./configure --prefix=/opt/pgsql; make; sudo make install
- Add
export PATH=/opt/pgsql/bin:$PATH
andexport MANPATH=/opt/pgsql/man:$MANPATH
to~/.profile
- Add
export PGDATA=/opt/pgsql/data
to~/.profile
NOTE: If this isn't set, postgres will complain about a missing conf file. - Open a new terminal session
- Type
psql -V
and check that it is the version you just installed - Create a data directory:
sudo mkdir $PGDATA
- Change ownership to postgres:
sudo chown postgres:postgres $PGDATA
- 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. - To run the database (will not be automatically started on boot):
sudo -u postgres pg_ctl start
- Open a new window, and type
sudo -u postgres createdb test
. If it saysCREATE 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.
- Download the latest stable tartball of mxDateTime
- Unpack the tarball and go into the directory
python setup.py build
sudo python setup.py install
- Download the latest stable tarball of psycopg1
export MACOSX_DEPLOYMENT_TARGET=10.4
export CPPFLAGS="-I/opt/python/lib/python2.4/site-packages/mx/DateTime/mxDateTime"
./configure --with-postgres-libraries=$(pg_config --libdir) --with-postgres-includes=$(pg_config --includedir)
make
sudo make install
- Run
python
, typeimport psycopg
into the interactive read-eval-print loop (REPL), andquit
the REPL.