A fresh supply of thoughts about Web Development & Mac OS X
Although Brian Rosner did a very good Screencast on installing and using Git with Django, there are sadly no Show Notes available. This makes installing Django from Git a quite time-consuming task, if you haven’t memorized the commands.
While writing down the commands for further use, I noticed that there’s a faster way than cloning the official SVN repository by using an unofficial Git mirror. Later on, I wrote a small Bash script to automate the Django-from-Git installation, which you can download below.
First, clone the repository with:
git svn clone -s http://code.djangoproject.com/svn/django django
navigate to the django folder and run:
git gc
to cleanup unnecessary files and optimize the local repository. Finally, reset the master branch to point to trunk:
git reset --hard trunk
Instead of going thrugh the time-consuming task of cloning the official SVN repository, there’s an faster and easier way. Matthias Kestenholz was so kind to set up a Git mirror for Django, which is updated hourly.
Just use the git clone command, as with any other Git repository:
git clone git://spinlock.ch/pub/git/django/django.git django.git
To save some time on the next “Django from Git” installation, I wrote a simple Bash script to automate this task.
The script will clone the unofficial Git mirror in a folder called django.git and create the necessary symbolic links to install Django:
After the download, you need to make the script executable:
chmod u+x django-git-install.sh
The script expects the installation directory as the first parameter:
Usage: django-git-install.sh target-directory
For example, to install Django into /usr/lib/django.git, execute:
sudo ./django-git-install.sh /usr/lib
Published: April 30, 2008 — Tagged: bash script, django, git, python
© 2008 Arthur Koziel — About | Archive | Colophon | Contact | Feeds