[kforge-user] kforge-0.13 installation issues

John Bywater john.bywater at appropriatesoftware.net
Tue Aug 21 15:22:59 UTC 2007


Tristan, Rufus,

> >> OK, that's weird because it implies mod-python couldn't import
> >> kforge.
> >> Does importing kforge from a python shell work i.e.:
> >>
> >> $ python
> >>  >>> import kforge
> >
> > yes it does.
> > And i can even use kforge web frontend. Service creation, user
> > management, etc all work well. Except for the authentication handler.


It may be that mod_python's usage of the 'imp' package is failing for 
the way KForge has been installed on your system. If your kforge package 
isn't installed on a path configured for Python eggs (I've read 
setuptools docs, and I'm still not sure what that actually means 
entirely) then you might try either (a) installing the kforge and dm 
package in one of the system's Python library paths i.e. don't use 
--home or --prefix or similar when installing ; or (b) [my preferred 
solution, and the one I took when I came across this problem when 
writing Provide] start 'breaking' Python eggs (in the case of KForge by 
unzipping the egg file and renaming the directory to 'kforge' plain and 
simple, unless it was installed unzipped when you can just symlink into 
the already extracted folder, whatever you need so you have a 
kforge/soleInstance.py on your path).

Explainer (unless it's mistaken):

The user management ("admin") part of KForge firstly has mod_python 
importing Django:

PythonHandler django.core.handlers.modpython

...(in the Apache config fragment you attached), with Django reading the 
environment variable DJANGO_SETTINGS_MODULE and then (on line 80 of 
django.conf) using Python's builtin '__import__' function to load the 
'kforge.django.settings.main' Python package.

However, the application service provision part of KForge (where SVN 
repositories and Trac services are) firstly has mod_python importing 
KForge to do access control:

PythonAccessHandler kforge.handlers.projecthost::accesshandler
PythonAuthenHandler kforge.handlers.projecthost::authenhandler

...(also in the Apache config you attached) before handing the request 
off to the the provided application service.

I learned a few weeks ago that the 'imp' module sometimes can't read 
Python eggs, but the '__import__' function can (not sure on the details, 
but it smells like a container dependency bad smell from setup tools to 
me). So if you installed KForge as a Python egg in a non-standard 
location, the "admin" part will work but the services won't.

This problem will have arisen since KForge moved to using setup_tools, 
which I believe is new with this release.

Summary:

EITHER
Break the egg open (its just a zip file of the source). Then 'imp' has a 
directory named after the package, and mod_python can import the kforge 
package.

OR
Don't do this:
$ python setup.py install --home=/my/local/folder
$ python setup.py install --prefix=/my/local/folder
Do this (or make sure your system does this):
# python setup.py install


If you're stuck I suggest breaking the KForge and DomainModel eggs open, 
and seeing whether it just works. You may need to break Routes open too 
if it was installed along with DomainModel.

Best wishes,

John.







More information about the kforge-user mailing list