[mod_python] 3.2.5b - Questions

Graham Dumpleton grahamd at dscpl.com.au
Mon Jan 23 17:02:37 EST 2006


Peter Sanchez wrote ..
> First, I upgraded from 3.2.2b to 3.2.5b last night, and immediately  
> started getting the following:
> 
> [Sun Jan 22 21:33:53 2006] [error] make_obcallback: could not import  
> mod_python.apache.\n
> Traceback (most recent call last):
>    File "/usr/local/lib/python2.4/site-packages/mod_python/ 
> apache.py", line 765, in ?
>      exists_config_define = _apache.exists_config_define
> AttributeError: 'module' object has no attribute 'exists_config_define'
> 
> So I edited apache.py and commented out that line, as I didn't see it 
> referenced anywhere else in the source. Seems to be fine so far, I  
> hope I am not gonna be needing that :) Any ideas on this one?

My guess is that you did an:

  apachectl restart

rather than:

  apachectl stop
  apachectl start

The old _apache module was still loaded into the parent Apache process
and when it forked to create the child processes, the newer Python code
couldn't find the function in _apache module it was expecting.

When upgrading mod_python it is always a good idea to properly stop
and start Apache. If you did, then check that the mod_python.so
module in the Apache modules directory is actually the newer one.

> Second, I switched our website, finally, to the new back end using  
> mod_python late last night. One thing I hadn't thought of though, was 
> all the subdirectories using mod_python as the default handler as  
> well (for images, etc.) So I ended up having to do the following to  
> my config (in a panic heh)
> 
> 
>      <Directory /home/ahcabron/public_html>
>          Options FollowSymLinks
>          AllowOverride All
>          Options -MultiViews
>          SetHandler python-program
>          PythonHandler mod_python.publisher
>          PythonAutoReload Off

PythonAutoReload option is actually broken in 3.2.5b. Finally fixed in
3.2.6. It looks like it was broken for some time.

>          #PythonDebug On
>      </Directory>
> 
>      <Location /main>
>          SetHandler default-handler
>      </Location>
> 
>      <Location /albums>
>          SetHandler default-handler
>      </Location>
> 
>      <Location /stats>
>          SetHandler default-handler
>      </Location>
> 
> 
> Is there a better way to do this other than a bunch of <Location>  
> directives?

Only by using a bunch of Directory directives instead. :-)

If you are not using extensions for URLs mapping to the
mod_python.publisher code, you could also use some of the tricks
discussed recently of disabling mod_python for any URL which
uses an extension in it or vice versa. See:

  http://www.modpython.org/pipermail/mod_python/2006-January/019918.html
  http://www.modpython.org/pipermail/mod_python/2006-January/020064.html

Look back and forth for issues discussed related to doing this.

Graham
  


More information about the Mod_python mailing list