[mod_python] About module autoreload

Gonzalo Sainz-Trápaga gomo at datafull.com
Sun Feb 20 02:07:05 EST 2005


Hi,
After reading the FAQ entry 3.1, i finally built my custom way to import
modules, on the lines of:

-- config.py --
debug = True
--

-- anyscript.py --
from mod_python.apache import import_module
config = import_module('config')
if config.debug:
    # reload other modules
--

This is a bit lengthy and annoying but then i found this directive in
the 3.x docs:

-- http://www.modpython.org/live/current/doc-html/dir-other-par.html --
PythonAutoReload {On,Off}
(...)
By default, mod_python checks the time-stamp of the file and reloads the
module if the module's file modification date is later than the last
import or reload. This way changed modules get automatically reimported,
eliminating the need to restart the server for every change.
--

If I explicitly set this directive to On, i get the expected behaviour
without manually reloading modules on every script. But, if i don't set
it i get the "Off" behaviour, instead of the "On" one as advertised in
the docs.

Actually I'm glad this directive exists and seems to do what I think it
does, but the FAQ must *really* be updated on this, and, if i'm not
mistaken, the default behaviour should be corrected either in the docs
or in mod_python (i would suggest the former, as automatically reloading
modules is the standard interpreter behaviour).

I wanted to check with you guys before I mess with the FAQ, in case i'm
getting something wrong. 

-- 
Gonzalo Sainz-Trápaga (GomoX)
GnuPG Fingerprint: A0AF 3BBF EB93 7EFE 6628  C5A5 F073 9442 6DE4 A497
Public Key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x6DE4A497
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20050220/9db7544d/attachment.bin


More information about the Mod_python mailing list