[mod_python] importing a configuration module

bharath venkatesh bharathv6.project at gmail.com
Mon Jul 28 06:31:04 EDT 2008


Hi all,
        I am using mod python and publisher handler  for handling request ..
I want to load to some configuration so that this configuration is used for
all the request ...
so  i placed the  all the configuration in a .py file and imported it .. and
also i am doing some initialization in this file .. so i want  it to be
imported only once ..
but  apache reimports when  a request occurs after a gap of certain time ..
it doesn't reimport  if the request occurs continuously .. this is
toleratable   if i am only l loading configuration but i am doing
initialization also .. so if want to write into a file using
open("filename","w") .. if i place this line in the file i  am  importing
then... the file gets truncated each time the the file is imported ... this
is not desirable ..
i tried even setting  PythonAutoReload off but still apache was reimporting
the module
i tried using PythonImport directive .. (eg PythonImport
/home/bharath/config.py /usr/bin/python2.5 ) couldn't figure out how to get
it work .. if i place the config.py file in a different directive than the
directive in which the handler is placed(assuming that apache  will  import
this module during start up as it does for library modules )  .. i am
getting  a import error and also if i place the config.py in the same
directory that of the handler and if import it .. apache reimports it as
usuall ...

how to let apache import a module only once as it does for python library
modules  but apache should reimport it the when changes are made in the file
that is imported ...

                                                   bharath
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20080728/988de67e/attachment.html


More information about the Mod_python mailing list