A better way to switch Django versions


Regarding my Windows junctions method for switching between Django versions, Alistair Lattimore wrote about a better way to do it.

He switches between Django versions using the site module’s path configuration files.  This sounds better than junctions, because the junction file is a special directory entry that you manipulate with a downloaded command-line tool.  Although it’s conceptually a symlink, it’s not as convenient to work with as a symlink.

And Alistair’s technique is pure Python, and OS-independent.  Sweet.

But, I haven’t yet gotten it working on my Windows box.  I’m betting the problem is PEBKAC, because Alistair sounds like a smart dude.  I posted a lengthy comment on his blog, and I’ll await his answer and help.

2008-2-12 update: Alistair pointed out my problem, which was bad lines in the .pth files.  They weren’t pointing at the correct level in the directory hierarchy.  After the fix, this technique works great.

To recap:

When I want to run 0.96.1, I create a c:\Python25\Lib\site-packages\django.pth that contains:

# Django path file
django_versions\django_0.96.1

When I want to run the trunk, I create a c:\Python25\Lib\site-packages\django.pth that contains:

# Django path file
django_versions\trunk

I do the .pth creation by using a tersely-named command (.bat) file to do the dirty work. You can use .bat files, or an alias command if you use a Windows add-on that gives you such a command.

One thought on “A better way to switch Django versions

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.