Bill, see my replies below.
> > Well, if sys.path is the same for both, they are both going to load > the same django. > > The exception to this is that, at least when python starts, the first > item o the path is > an empty string, representing the relative path to the current > directory (at startup), > which, I believe, has been replaced by an absolute path to the same directory > by > the time manage.py gets moving. I would really hope that this > difference is reflected > in sys.path's first entry (or that it is still an empty string). > Since you summarize > rather than paste that output, I can't check for you. Here is the full sys.path ['/home/camtechnet/src/camtechnet', '/usr/lib/python2.5/site-packages/html5lib-0.11.1-py2.5.egg', '/home/test-camtechnet/src', '/usr/lib/python25.zip', '/usr/lib/python2.5', '/usr/lib/python2.5/plat-linux2', '/usr/lib/python2.5/lib-tk', '/usr/lib/python2.5/lib-dynload', '/usr/local/lib/python2.5/site-packages', '/usr/lib/python2.5/site-packages', '/usr/lib/python2.5/site-packages/PIL', '/var/lib/python-support/python2.5', '..'] > > When you say deployed the django source, I'm guessing that you mean unpacked > the > egg or tar or zip there. But how are you arranging for python to find > it? When you > install django in the default way, it usually goes somewhere like: > > /usr/lib/python2.6/site-packages/ > We deploy the django source ONLY within our project folders. This whole setup was done by a colleague, who has since dissappeared :-( > Which python searches by default (you should see a site-packages > directory one or more > times in your sys.path). > > So, for it to have found django in /home/test-project/src/ that path > would have had to be > added to sys.path somehow. This can't be in your settings.py because > manage.py > imports django (part of importing django.core.management, if you look > at manage.py in > an editor) before it imports settings. So, either you have a modified > manage.py that > fiddles with sys.path first, or you have a strangely configured > python, or, more likely, > you have the PYTHONPATH environment variable configure to do this, > since python checks > for this and adjusts the path up front if it finds it. > #!/usr/bin/env python import sys sys.path.append('..') from django.core.management import execute_manager try: import settings # Assumed to be in the same directory. except ImportError: import sys sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__) sys.exit(1) if __name__ == "__main__": execute_manager(settings) > If it is the environment variable, it is probably set in your > .profile, .bashrc, .bash_profile, or > .bash_login files. (Use "ls -a" to see these "hidden" files - those > whose name begins with > a period - if they are present.) > > If it's the environment variable, you can: > > Change it by hand before running a particular version > I have now manually modified .bashrc file, to try at least and get things working. The file now contains teh following export PYTHONPATH="/home/project/src" I have restarted apache, and yet when I go back and check sys.path it has not changed. ['/home/camtechnet/src/camtechnet', '/usr/lib/python2.5/site-packages/html5lib-0.11.1-py2.5.egg', '/home/test-camtechnet/src', '/usr/lib/python25.zip', '/usr/lib/python2.5', '/usr/lib/python2.5/plat-linux2', '/usr/lib/python2.5/lib-tk', '/usr/lib/python2.5/lib-dynload', '/usr/local/lib/python2.5/site-packages', '/usr/lib/python2.5/site-packages', '/usr/lib/python2.5/site-packages/PIL', '/var/lib/python-support/python2.5', '..'] So my final question (I promise!) is why the PYTHONPATH change has not been picked up, even after restartin Apache? Thanks again, Mauro
-- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.