As I’ve written earlier, I’m playing with Django these days. It’s a refreshing change, I must say, even if I admit that I prefer Ruby’s syntax to Python’s. Of course that’s just a purely subjective impression (I’m writing this while I try to avoid the rotten tomatoes thrown by angry pythonistas reading this) that does nothing to do with the power of the Python language + framework, which is by all means absolutely impressive.
In any case, I had to install a working Django environment in my machine, and while following the excellent and free Django Book instructions, this is what I did in my Leopard installation to have it up and running (Leopard already comes bundled with Subversion 1.4.4, Python 2.5.1 and SQLite 3.4.0, so you don’t need to do anything about them):
- Checkout the latest version of Django from its Subversion repository:
cd ~
svn co http://code.djangoproject.com/svn/django/trunk django_trunk
This will create a ~/django_trunk folder in your home directory. - Edit the .tcshrc file (yes, I use tcsh) with the following instructions:
setenv PATH /Users/adrian/django_trunk/django/bin:$PATH
setenv PYTHONPATH /Users/adrian/django_trunk
This will make the Django files available to your Python installation. - Open Terminal.app and cd to your ~/Desktop
- Follow my instructions about how to fix the bug in Leopard’s Terminal.app, which can be quite disappointing after all.
- Create a new Django project:
django-admin.py startproject [PROJECT_NAME] - Start the development server:
python manage.py runserver [IP:PORT] [PORT]
By default it listens on the port 8000, so you can browse to http://localhost:8000/ to see your fresh new system. - Start the command-line interface (similar to Rails’ “script/console”):
python manage.py shell - If you follow the Django Book instructions, you might find that you cannot use models with “ImageField” columns; you need to install first the Python Imaging Library doing the following:
curl http://effbot.org/media/downloads/Imaging-1.1.6.tar.gz -o Imaging-1.1.6.tar.gz
tar xvfz Imaging-1.1.6.tar.gz
cd Imaging-1.1.6
python setup.py build
sudo python setup.py install
cd ..
rm Imaging-1.1.6.tar.gz
rm -r Imaging-1.1.6 - That’s all!
I hope this helps. Doing these steps I could have a working installation, and everything shown in the book worked perfectly well. It’s an impressive framework! I look forward to learn more about it.
Similar Posts:

Commenting