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
-~----------~----~----~----~------~----~------~--~---