Thanks Malcolm.  That really cleared things up for me!  Now I can
relax, just a little, for the holiday weekend.  That was really
driving me nuts!


On Aug 29, 6:06 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Fri, 2008-08-29 at 15:00 -0700, lingrlongr wrote:
> > I can see some differences between the Python Path for the dev server
> > (manage.py runserver) and apache/mod_python.  I created an error in a
> > template using an invalid tag so the Django pretty error screen
> > appears.  Using the development server I see:
>
> > Python Path:       ['/home/django/proj/loan', '/usr/lib/python25.zip', '/
> > usr/lib/python2.5', etc...
>
> > When setting up my apache conf according to the documentation, the
> > Python path looks like this:
>
> > Python Path:       ['/home/django/proj/', '/usr/lib/python25.zip', '/usr/
> > lib/python2.5', etc...
>
> > If I set the PythonPath in my apache conf like this, _______the site
> > works_____:
>
> > PythonPath "['/home/django/proj','/home/django/proj/loan'] + sys.path"
>
> > Thoughts?
>
> Short version: the problems you were seeing are 100% related to this
> problem. Your Python path was incorrect and you started seeing problems.
>
> Longer version...
>
> This is something people really seem to struggle with in Python, but
> it's a very consistent rule: the parent directory of anything you are
> importing must be in the Python search path. So if you are writing
>
>         import foo
>
> and foo is inside the loan/ directory, then loan/ must in the Python
> path. If you are writing
>
>         from loan import foo
>
> then the parent directory of loan/ must be in the Python path. And so
> on. There are some subtleties with things like eggs and .pth files and
> so on, but you can ignore those and not be any worse off.
>
> This is documented in the Django documentation for setting up
> mod_python, but it's not something that is special to Django. It's how
> Python works.
>
> Regards,
> Malcolm
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to