[mod_python] Howto force reload of all modules

Bart scarfboy at gmail.com
Mon Sep 3 20:34:53 EDT 2007


On 9/1/07, hhanke at pdx.edu <hhanke at pdx.edu> wrote:
> > In summary, with mod_python your production box is best used only for
> > deployment and not for development. You can only get so far using
> > 'import_module()' properly on a production box, sometimes you just
> > cant avoid doing a restart. Thus you really need to use a separate
> > Apache instance when you are doing development with mod_python if you
> > have no ability to restart your production server.
>
> Hi Graham,
>
> thanks for the explanation. I've read the documentation, but as I
> said before, I can't use 3.3 yet. It is not only about
> developement/production, but also production/production, because
> when there is a new version of the software, I do not have any
> reasonable way how to run the new code.
>
> Anyway, I understand there is no use in complaining about
> something that was fixed already. We just need to push our
> admin to install mod_python 3.3 ASAP.

I have a similar problem, also on a production server that I don't have
admin control over.
I settled on a module that runs through a list of names I want
apache_import()'d, (it's a fairly short list after all)
which I apache_import-and-call in all handlers. It seemed the
simplest hack that does approximately what I want,
and it can be easily disabled with a little commenting.

(It's conceivable you can hack something together that looks at
sys.modules and each module's __file__ but beyond doubting it'll
work at all I also doubt it's particularly mp-version-portable.)

--Bart


More information about the Mod_python mailing list