views:

45

answers:

2

I have a python script that parses a large set of data into an internal memory structure, and implements various fetch functions on the structure.

I want to built a simple web frontend for this script, with the condition that the data is only initialized/loaded once (since re-loading upon each fetch would consume too much time/resources). Essentially, the python handler needs to maintain its state between calls, so the data structure is preserved in memory.

Note: PHP's exec() or similar will not work, as this instantiates a new python handler per request. I have heard vague references to using mod_python for this purpose?

+1  A: 

I have implemented a solution to a very similar problem. My solution was to use an xmlrpc server, specifically

twisted.web.xmlrpc

I have a method that allows for injection of new data, and have methods for retrieving the data.

sberry2A
A: 

Use a persistent server like CherryPy or Twisted Web. All requests will be served by the same process.

keturn