6

My setup is Django 1.2 running via mod_wsgi under Debian Lenny.

I have a such structure:

/root/
    project1/appx
                 models.py
    project2/appy
                 models.py
                 management/
                           commands/
                                   mycommand.py

Now I want to import Foox model from project1 to project2.

What would be the easiest solution WITHOUT moving the whole project dir to Python_path ? I especially need a solution without using mod_wsgi because I will be importing this model from project1 to custom manage.py command called "mycommand" in project2 ?

Hellnar
  • 62,315
  • 79
  • 204
  • 279

2 Answers2

8
import sys
sys.path.append('/root/project1')
from appx.models import Foox
Daniel Roseman
  • 588,541
  • 66
  • 880
  • 895
0

How about:

$ cd /root/project2
$ ln -s ../project1/appx

?

Seth
  • 45,033
  • 10
  • 85
  • 120