[mod_python] Newbie Questions

g.farina at pharaondev.com g.farina at pharaondev.com
Mon Nov 13 04:01:53 EST 2006


Hi

I just started to develop with modpython and I have some questions about
quite simple topics.
First of all, correct me if I wrong, I read that modpython works as a
layer between Apache APIs and Python scripts: when apache needs an handler
for a particular operation, it asks modpython for this handler and
modpython returns it based on some configurations.
Is that right?

Based on this considerations, I have some questions:
1 - There is a way to call some code only when modpython is called for the
first time ? I have to load a huge configuration file, and I'd like to do
it only once and share the loaded object with all the handlers.
2 - I have to implement a simple MVC framework that uses a mechaninc
similar to the Publisher handler. But I need to interact with the object
that will be published, capturing the data returned by some functions and
sharing singleton among them. Previously I loaded the files using exec but
now I can't do that due to this reasons. Using import (or the imp module)
is not the right way because I'd like the memory used by the controllers
to be freed when the execution stops. There is a way to do that ?
3 - Modpython starts a subinterpreter for every call to the handler ?

Thanks,
Gabriele



More information about the Mod_python mailing list