Developing with multiple versions of Django on windows
At Ai, we have sites that use various versions of Django, so there is a need to switch packages. On my mac I use virtualenv to handle this, but I’ve never quite gotten it to play nice with windows, and just switching Django versions has sufficed so far.
- Download junction (think symbolic links for windows). Put the executable somewhere in your path. I put it in my Python scripts folder (C:\Python26\Scripts)
- Plan out your directory structure: Make sure you don’t have any stock django eggs or folders in your site-packages folder
- Create a django_veresions folder in site-packages (C:\Python26\Lib\site-packages\django_versions)
- In this folder I put my different django installs
C:\Python26\Lib\site-packages\django_versions\1.1\django C:\Python26\Lib\site-packages\django_versions\1.3\django C:\Python26\Lib\site-packages\django_versions\1.4\django
- I also put a txt file inside the django folder to easily see what version is there (this will be helpful later to double check)
C:\Python26\Lib\site-packages\django_versions\1.4\django\1.4.txt
- Create a file called djangoversion.cmd and drop it in C:\Python26\Scripts
junction -d C:\Python26\Lib\site-packages\django junction C:\Python26\Lib\site-packages\django C:\Python26\Lib\site-packages\django_versions\%1\django
- The first line removes any links that may have been there. The second line creates a new link to the version you’ll pass in.
- Now, to switch versions, just run this from the command line:
djangoversion 1.4
PS C:\Users\tbroder> djangoversion 1.4 C:\Users\tbroder>junction -d C:\Python26\Lib\site-packages\django Junction v1.06 - Windows junction creator and reparse point viewer Copyright (C) 2000-2010 Mark Russinovich Sysinternals - www.sysinternals.com Deleted C:\Python26\Lib\site-packages\django. C:\Users\tbroder>junction C:\Python26\Lib\site-packages\django C:\Python26\Lib\site-packages\django_versions\1.4\django Junction v1.06 - Windows junction creator and reparse point viewer Copyright (C) 2000-2010 Mark Russinovich Sysinternals - www.sysinternals.com Created: C:\Python26\Lib\site-packages\django Targetted at: C:\Python26\Lib\site-packages\django_versions\1.4\django PS C:\Users\tbroder>
- Switch as needed

