[ http://issues.apache.org/jira/browse/MODPYTHON-10?page=all ] Graham Dumpleton closed MODPYTHON-10: -------------------------------------
> Continual reloading of modules > ------------------------------ > > Key: MODPYTHON-10 > URL: http://issues.apache.org/jira/browse/MODPYTHON-10 > Project: mod_python > Type: Bug > Versions: 3.1.3 > Reporter: Graham Dumpleton > Priority: Minor > Fix For: 3.2.7 > > From mailing list post. > Continual reloading of modules > ------------------------------ > Create a subdirectory called "publisher". In that directory create a > ".htaccess" file containing: > SetHandler python-program > PythonHandler mod_python.publisher > PythonDebug On > Now create two subdirectories "subdir-1" and "subdir-1". In both of these > subdirectories create an "index.py" file which contains: > import os > def index(): > return os.getpid(),__file__ > Restart Apache to clear any cached modules and then cycle between the URLs > corresponding to the two subdirectories. In my case this is: > /~grahamd/publisher/subdir-1 > /~grahamd/publisher/subdir-2 > /~grahamd/publisher/subdir-1 > /~grahamd/publisher/subdir-2 > ... > The output for each page was in turn: > (462, '/Users/grahamd/Sites/publisher/subdir-1/index.py') > (462, '/Users/grahamd/Sites/publisher/subdir-2/index.py') > (462, '/Users/grahamd/Sites/publisher/subdir-1/index.pyc') > (462, '/Users/grahamd/Sites/publisher/subdir-2/index.pyc') > ... > If you look at the Apache error log file you will see something like: > [Tue Jan 25 09:03:45 2005] [notice] mod_python: Creating 32 session mutexes > based on 4 max processes and 25 max threads. > [Tue Jan 25 09:03:45 2005] [notice] Apache/2.0.51 (Unix) mod_python/3.1.3 > Python/2.3 configured -- resuming normal operations > [Tue Jan 25 09:04:02 2005] [notice] mod_python: (Re)importing module > 'mod_python.publisher' > [Tue Jan 25 09:04:02 2005] [notice] mod_python: (Re)importing module 'index' > with path set to '['/Users/grahamd/Sites/publisher/subdir-1']' > [Tue Jan 25 09:04:16 2005] [notice] mod_python: (Re)importing module 'index' > with path set to '['/Users/grahamd/Sites/publisher/subdir-2']' > [Tue Jan 25 09:04:26 2005] [notice] mod_python: (Re)importing module 'index' > with path set to '['/Users/grahamd/Sites/publisher/subdir-1']' > [Tue Jan 25 09:04:40 2005] [notice] mod_python: (Re)importing module 'index' > with path set to '['/Users/grahamd/Sites/publisher/subdir-2']' > You will see how as one cycles between the two URLs corresponding to the > modules, that the modules are reimported everytime. > Note that I ensured that only one Apache server process was initially > started so that all requests served by same process. One can also see this > is the response, which includes the process ID of the server process. > Overall what is returned is correct, but it isn't efficient because each > request is triggering a module import. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira