[mod_python] How to stop reimporting modules

Graham Dumpleton grahamd at dscpl.com.au
Fri Apr 8 17:45:56 EDT 2005


Turning off module autoreloading probably will not actually help.
It is a known problem when using the same module name in multiple
directories such as with "index.py". see:

   http://issues.apache.org/jira/browse/MODPYTHON-9
   http://issues.apache.org/jira/browse/MODPYTHON-10
   http://issues.apache.org/jira/browse/MODPYTHON-11

Only choice if using mod_python.publisher is to make sure every
Python code file on the site is uniquely named.

Only other alternative is to investigate the drop in replacement
for mod_python.publisher that comes with Vampire and which tries
to address this specific issue. The version in Vampire isn't 100%
compatible because of the way in which it goes about fixing this
and other problems in mod_python.publisher, so depending on how
complicated your site, it may or may not be a trivial matter to
switch over.

Vampire can be found at:

   http://www.dscpl.com.au/projects/vampire

Graham

On 09/04/2005, at 1:42 AM, Jason Lanquist wrote:

> Hi, I've got a page that refreshes itself every 45 seconds (fetching
> dynamic content).  When it does this, the following line is added to 
> the
> apache error_log:
>
> [notice] mod_python: (Re)importing module 'rt_track' with path set to
> '['/home/hh4/public_htm
> l']'
>
> rt_track is not a py file, rather it's defined in index.py.  index.py
> doesn't get updated very much at all anymore so I'm wondering why it 
> has
> to reimport each time?
>
> Currently I have a couple of people beta testing this site but only
> after a couple of hours, our error_log file is quite big with these
> [notice] entries being added so frequently.  I dread to think of 
> looking
> at the log once more people start using it.  If this isn't a problem, 
> is
> there a way to get it to stop reimporting rt_track.  Is there a problem
> with the way I am setup?
>
> I'm running Linux Slackware 2.4.22 kernel
>             Apache 2.0.49
>             mod_python 3.1.3
>             Python 2.3.3
>
> mod_python setup in httpd.conf
> ---------------------
> ...
> <Directory "/home/hh4/public_html/">
>   AllowOverride All
>   PythonInterpPerDirectory On
> </Directory>
> ...
> ---------------------
>
> /home/hh4/.htaccess
> ---------------------
> SetHandler mod_python
> PythonHandler mod_python.publisher
> PythonDebug On
> <Files ~ "\.(gif|jpe?g|png|class|js|wav|css)$">
>   SetHandler default
> </Files>
> ---------------------
>
> I saw in the archives that turning PythonDebug Off will stop this but
> since I am still in the debugging mode, PythonDebug is extremely 
> helpful
> to us so I would like to not have to turn that off.
>
> Thanks,
>
> Jason Lanquist
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python



More information about the Mod_python mailing list