- 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:
Things change again.
Many things frustrated me with Ruby on Rails. I hate migrations. I also ran into issues with the auto-pluralization of models and database tables. Finally, I figured out that RoR was focused toward supporting user-created content and doesn't provide the same benefits when you are making a web application, let alone a web game. And then there's Ruby, a language that, while beautiful, has a strong learning curve to get the most out of it.
So I changed again.
For some reason, I started looking at Python. I've never programmed in Python before, but I knew it was C-like. I read through a couple of tutorials, and docs, and liked what I saw. It has the fun and power of Ruby, but is easier and more approachable.
The next step was to find a good web framework. The first one I looked at was Django. To me the most important things in a web framework are its Object Relational Mapping, its content management tools, and its ease of data access. I looked at the other Python frameworks, and liked Django the best.
So I switched again, so sue me! On to v7.0!
So I changed again.
For some reason, I started looking at Python. I've never programmed in Python before, but I knew it was C-like. I read through a couple of tutorials, and docs, and liked what I saw. It has the fun and power of Ruby, but is easier and more approachable.
The next step was to find a good web framework. The first one I looked at was Django. To me the most important things in a web framework are its Object Relational Mapping, its content management tools, and its ease of data access. I looked at the other Python frameworks, and liked Django the best.
So I switched again, so sue me! On to v7.0!
Subscribe to:
Posts (Atom)