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:
- c:\Python25\Lib\site-packages\django_versions
- c:\Python25\Lib\site-packages\django_versions\django_0.96.1 contains the contents of http://code.djangoproject.com/browser/django/tags/releases/0.96.1
- c:\Python25\Lib\site-packages\django_versions\trunk contains the contents of (it’s actually an SVN checkout of) http://code.djangoproject.com/browser/django/trunk
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.
You have to appreciate the simplicity of it all.
😀