- Get Python. This was the easiest part because Python is installed by default on Mac OS X. Not only that, but Leopard includes the most up to date version (2.5.1). You can check the version by typing in python at the terminal.
- Install Django. There are 2 Django releases, the released version, and the development version. The documentation does a great job of pointing out what features are available in the current dev version. While normally I only trust the released versions, I liked many of the new features (especially the named URL paths which was probably taken from Rails) so I decided to go for the recent build. Installation wasn't too bad, primarily because subversion is also installed with Tiger. The only problem was that the documentation gives two different methods of installation. The tutorial suggests adding a symbolic link in the python lib directory and the usr/bin directory. The Djano book gave instructions for adding a path document and including django in the system PATH variable. I did the latter, putting my djtrunk directory in /Library/. The only thing to know is that the site-packages directory is in /Library/Python/2.5.
- Install MySQLdb. A database binding is needed so that Python can talk to MySQL. You can get MySQLdb from its SourceForge site. After downloading and extracting the tar-gzip, you must edit site.cfg to point to the installation of mysql. Replace the line that begins with #mysql_config with:
mysql_config = /usr/local/mysql/bin/mysql_config
Next you need to do a little work to prevent some errors. See the post here and follow steps 3 and 4.EDIT: 12/23/08: Murphy remains an optimist, and the link above is gone. Here are the needed steps:
- edit _mysql.c and comment out the line "#define uint unsigned int".
- And then type in this:
sudo mkdir /usr/local/mysql/lib/mysql
sudo cp /usr/local/mysql/lib/libmysqlclient_r.16.dylib /usr/local/mysql/lib/mysql/libmysqlclient_r.16.dylib
Finally, install from terminal with the following:
python setup.py build
sudo python setup.py install
Wednesday, January 30, 2008
Setting up Django
Here's the steps to setup Django:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment