Matt Conrad wrote:
> Thanks for the reply. I don't quite understand yet.  Let's see how close I am.
>
> I have a Python application directory (on my machine,
> C:\apps\Python25\).  Inside that directory I have
> \Lib\site-packages\django, which is currently v0.96.
>
> Right now, the PYTHONPATH environment variable is not set at all on my
> machine.  When I work through Django examples, I can run "manage.py"
> from my Django application folder (C:\work\djcode\mytut\) and
> automatically talk to django modules, which are presumably in
> \Lib\site-packages\django.  This happens, I assume, because
> C:\apps\Python25\ is on my system path, and either a) Python
> automatically checks the \site-packages\ subdirectory for imports, or
> b) a hook was added when I installed Django, so that Python knows to
> look there for "django" imports.
>
> I have not installed Django v1.0 yet.  I will have to do something
> when I install it so as not to overwrite the version already in
> \site-packages\.  The obvious solution is to rename the existing
> directory to (say) django096 before installing, but I don't know what
> I might break when I do that.
>
> I'm not sure we're on the same page, but maybe you are telling me that
> if I rename the old directory and then install v1.0 so that I have
> both \django (1.0) and \django096 (0.96) both under \site-packages\,
> that I can set the PYTHONPATH variable to tell python to
> preferentially choose one of these directories over the other?  Or are
> you perhaps talking about having different installs of Python itself,
> or something else entirely?
>   
It sounds like you're new to python programming. Your PYTHONPATH is
where python looks for modules. To see what yours is, do this in a
python interpretor:

>>> import sys
>>> sys.path

You'll see the list of directories that python searches, in order, for a
Python module.

You can influence what this list is, by setting the PYTHONPATH
environmental variable. All you need to do is set your PYTHONPATH
appropriately, and point it to the appropriate place, depending on which
Django installation you need to use. Anything in the PYTHONPATH
environmental variable is put at the beginning of sys.path in the python
interpretor.

You can't just rename the django directory and expect it to work-- it won't.

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to