Version 24 (modified by 18 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. A write up walking through the packages to install with DarwinPorts to get a quick install running is available at http://www.rhonabwy.com/wp/2006/07/20/installing-django-on-macos-x-development-version/
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, unpack and go into the directory
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.
I had some issues with the above instructions for installing psycopg, and had to refer directly to the untarred installation source for mxDateTime in order to get the headers. To do this change the configure command to:
./configure --with-postgres-libraries=$(pg_config --libdir) --with-postgres-includes=$(pg_config --includedir) --with-mxdatetime-includes=[path/to/mxdatetime]/egenix-mx-base-2.0.6/mx/DateTime/mxDateTime
Darwin Ports way
Alternative method for installing psycopg is using the darwin ports
- sudo port install py-egenix-mx-base
- sudo port install py-psycopg
Darwin ports are available at http://darwinports.opendarwin.org/