Sunday, March 27, 2011

django setup on osx

Quick steps to having a django site on OS X, here are the terminal commands:
Assumptions -
  • You have git installed
  • Current python release is 2.6
  1. cd ~/Downloads
  2. git clone https://github.com/django/django.git
  3. mv ~/Downloads/django/django /Library/Python/2.6/site-packages/
    (at this point you can test the installation by opening a python terminal and attempting to import django)
  4. sudo ln -s /Library/Python/2.6/site-packages/django/bin/django-admin.py /usr/bin/django-admin.py 
You can now make a first project:
  1. cd ~/
  2. mkdir Django
  3. cd Django
  4. django-admin.py startproject djangoFirst
Project and Web Applications are different things, you can add a web application to a project with the following command(from within your ~/Django/djangoFirst:
  • python manage.py startapp poll 
That's all it takes for the basics.  You can test the python project with the built in server (for dev/test purposes only, not production) with this command:
  • python manage.py runserver
If you're just getting started with django I'd recommend reading up on the design patterns behind it a bit.  The purpose of this post was just to get it running in OS X, anything beyond that will wait until I spend a bit more time with the environment.

No comments:

Post a Comment