[mod_python] Persistent web-service

Lee Brown administrator at leebrown.org
Mon Sep 12 20:37:56 EDT 2005


The default behavior of mod_python is to create a new python interpreter for
each Apache vhost.  This interpreter is initialized on server startup and
persists until server shutdown/restart.  By using mod_python's PythonImport
statement in your Apache config file, you can have a python module execute
when the interpreter starts.  Put your startup initialization routines and
your per-request function calls in this module.

Best Regards,
Lee E. Brown
(administrator at leebrown.org)

-----Original Message-----
From: mod_python-bounces at modpython.org
[mailto:mod_python-bounces at modpython.org] On Behalf Of Doru-Catalin Togea
Sent: Monday, September 12, 2005 10:31 AM
To: mod_python at modpython.org
Subject: [mod_python] Persistent web-service


I am not sure wheather I should use the word service or server (or something
else) in the following, so I will stick to "service".

I have some C code which I need to call from mod_python in a web-service
implementation. I need a persistent web-service, meaning either that my
service is started up when Apache starts, or at the first call made for my
service. What I need is to have some C-structs initialized and which survive
calls to my service, until Apache shuts down. If it wasn't for this need of
persistency I could use some simpler mechanisms like CGI.

To put it another way, I need a CORBA-like server, only based on Apache. 
In a CORBA implementation, the server keeps running and serves requests from
clients as they arrive, without losing state between calls.

Any suggestions on how to go about this task using Apache and mod_python?

Thanks for helping,


         <<<< ================================== >>>>
         <<     We are what we repeatedly do.      >>
         <<  Excellence, therefore, is not an act  >>
         <<             but a habit.               >>
         <<<< ================================== >>>>
Mod_python mailing list
Mod_python at modpython.org

More information about the Mod_python mailing list