Version 2 (modified by SmileyChris, 9 years ago) (diff)

Code formatting

This is a message that I sent to the django-users mailing list describing how I manage to run two Django versions on Dreamhost. Pasted here with some modifications.

After some time I've managed to be able to run Django 0.91 and and the SVN version together on Dreamhost. I had a few projects done in 0.91 and I couldn't simply "svn update" the django_src directory.I've followed Dreamhost's wiki instruction to install Django so the directory names are from there.

Create a directory for 0.91:

mkdir $HOME/django_091/

Copy django_src to django_091 (or grab a 0.91 copy and put there):

cp -r django_src/* django_091

Edit .bash_profile to accept the two Django dirs (don't know if it's really needed but I did it :p)

export PATH=$PATH:$HOME/django_src/django/bin:$HOME/django_091/django/bin
export PYTHONPATH=$PYTHONPATH:$HOME/django_src/:$HOME/django_091:$HOME/django_projects

Edit all the django.fcgi files you have, replacing:

sys.path += !['/home/inerte/django_src']

with:

sys.path += !['/home/inerte/django_091']

Go to each project and make a link do django_091/django, so module imports are done on the correct directory:

ln -s $HOME/django_091/django $HOME/django_projects/your_project_name/django

Remove two !__init!__.pyc files otherwise /admin/ will complain that someone messed with "magic numbers" (a django security thing, I suppose?):

rm django_src/django/contrib/admin/urls/!__init!__.pyc
rm django_src/django/contrib/admin/models/!__init!__.pyc

Update django_src to the newest SVN

cd django_src
svn update

Restart some stuff:

pkill fcgi.py;pkill python

And that's it :) Old projects living with 0.91, new ones living with SVN. As you convert your old stuff to the new Django syntax, remove the links made previously so Django imports from django_src:

rm django_projects/your_project_name/django
Back to Top