OK, here's another wrinkle: The modules in that folder import fine on
the browser end. I put tagging in there, and that shows up in my admin
list with no errors. So mod_python is picking up the vhost file, but
I'm not getting it in the shell. Thus when I try python manage.py
shell with anything from the apps folder installed, I get a "no module
named tagging" error and can't get into the shell.

Here's what sys.path looks like in the shell:

/var/www/vhosts/redfenceproject.com/redfence/redfenceproject
/usr/lib64/python2.4/site-packages/setuptools-0.6c5-py2.4.egg
/usr/lib64/python2.4/site-packages/MySQL_python-1.2.2-py2.4-linux-
x86_64.egg
/usr/lib64/python24.zip
/usr/lib64/python2.4
/usr/lib64/python2.4/plat-linux2
/usr/lib64/python2.4/lib-tk
/usr/lib64/python2.4/lib-dynload
/usr/lib64/python2.4/site-packages
/usr/lib64/python2.4/site-packages/Numeric
/usr/lib64/python2.4/site-packages/gtk-2.0
/usr/lib/python2.4/site-packages

It looks like I'm not loading either directory here.

I'm using mod_python-3.2.8-3.1

On Nov 25, 10:53 pm, Graham Dumpleton <[EMAIL PROTECTED]>
wrote:
> On Nov 26, 5:38 pm, Chris Amico <[EMAIL PROTECTED]> wrote:
>
> > Right. And the PythonPath directive ought to do the trick, but it
> > clearly isn't. The server belongs to a friend who gave me permission
> > to everything under the redfenceproject.com directory (one above
> > redfence), and I created the apps folder, so I'm not sure what the
> > problem is.
>
> Where else in main Apache configuration files or .htaccess files is
> PythonPath directive mentioned?
>
> Can you better describe the directory hierarchy and not say '...'.
> Actual directory listings (ls -las) of each of the directories you
> have already added to PythonPath would help.
>
> This would be so much more predictable if using mod_wsgi. Python path
> stuff in mod_python is a PITA and causes so many problems, although
> documentation for mod_python setup doesn't help much. :-(
>
> BTW, what version of mod_python are you using?
>
> Graham
>
> > On Nov 25, 10:29 pm, Graham Dumpleton <[EMAIL PROTECTED]>
> > wrote:
>
> > > On Nov 26, 5:13 pm, Chris Amico <[EMAIL PROTECTED]> wrote:
>
> > > > I have a handful of apps in that folder. I can add it to sys.path
> > > > using sys.path.insert(0, path) and they import fine after, but that
> > > > only lasts one session. How do I make it stick?
>
> > > That is what PythonPath directive is for.
>
> > > Graham
>
> > > > On Nov 25, 5:28 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
> > > > wrote:
>
> > > > > On Tue, 2008-11-25 at 14:55 -0800, Chris Amico wrote:
> > > > > > Hi folks,
>
> > > > > > I'm having some trouble getting a directory onto my pythonpath. I'm
> > > > > > sure I'm missing something obvious here.
>
> > > > > > On my server, I have a directory with my django work called 
> > > > > > redfence.
> > > > > > Inside is my project, along with a folder called 'apps' holding all 
> > > > > > my
> > > > > > personal and third party apps. It's the apps folder I can't seem to
> > > > > > get python to recognize.
>
> > > > > > Redfence shows up, and the main project folder, redfenceproject,
> > > > > > imports fine. But apps doesn't and I need to be able to put modules
> > > > > > there.
>
> > > > > > Here's what I have in a vhost.conf file:
>
> > > > > > <Location "/">
> > > > > >     SetHandler python-program
> > > > > >     PythonHandler django.core.handlers.modpython
> > > > > >     SetEnv DJANGO_SETTINGS_MODULE redfenceproject.settings
> > > > > >     PythonOption django.root /
> > > > > >     PythonDebug On
> > > > > >     PythonPath "['/.../redfence/apps', '/.../redfence'] + sys.path"
> > > > > >     SetEnv PYTHON_EGG_CACHE /var/www/vhosts/
> > > > > > redfenceproject.com/.python-eggs
> > > > > > </Location>
>
> > > > > > Any help is much appreciated.
>
> > > > > Nothing look immediately wrong to me.
>
> > > > > So, the first question here is whether you've checked the permissions 
> > > > > on
> > > > > apps/? Apache will need execute permissions for the "other" section in
> > > > > order to traverse into that directory. Since you suggest that things
> > > > > inside redfence/ are imported fine, it sounds like the permissions are
> > > > > okay at least down to that level, so I'd have a look at the
> > > > > redfence/apps/ permissions.
>
> > > > > How are you verifying that nothing imports from apps/? For example, I
> > > > > would try putting a really simple file in there that, when imported,
> > > > > prints a message to sys.stderr (and then calls sys.stderr.flush()
> > > > > because modpython buffers stderr) and check the Apache error log for
> > > > > your virtual host. Essentially, take Django out of the equation for 
> > > > > the
> > > > > time being. You could even put the little test function from the
> > > > > modpython documentation into that directory and use that as the 
> > > > > handler
> > > > > to check the python path is set up correctly.
>
> > > > > (As an aside: I doubt that you need to specify django.root in that
> > > > > config. That option is only need if you SCRIPT_NAME is *not* going to 
> > > > > be
> > > > > '/'.)
>
> > > > > 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