[ILUG] IPC and CGI
P at draigBrady.com
P at draigBrady.com
Thu Apr 7 17:52:45 IST 2005
Michael Thompson wrote:
> On Apr 7, 2005 2:53 PM, Dale Dunlea <daledunlea at commergy.com> wrote:
>
>>Hi All,
>>
>>I have a CGI script. It's python, but I'm not set in stone on this.
>>Anyway, it has to parse a reasonably large, and largely static, file at
>>startup before doing its thing. The problem is that the file it must
>>parse is likely to grow over time, and will get quite large. Which means
>>that parsing it every time the CGI scripts gets run is going to be
>>arduous and may become unacceptably slow.
>
>
> I'd second the suggestion to use a database backend, but to answer your
> question mod_python should solve some of your problems:
>
> Mod_python is an Apache module that embeds the Python interpreter within the
> server. With mod_python you can write web-based applications in Python that
> will run many times faster than traditional CGI and will have access to
> advanced features such as an ability to retain database connections and
> other data between hits and access to Apache internals
This is a good option. To be a little more concrete about it.
In your python (or psp) file loaded by mod_python you can do:
from mod_python import apache
yourmodule=apache.import_module("yourmodule",1)
This will only reload (and compile) your module
when it changes on disk. So yourmodule.py could
automatically be updated when the data is changed
(with a timestamp for e.g.) and python would do
the synchronisation automatically.
--
Pádraig Brady - http://www.pixelbeat.org
--- Following generated by rotagator ---
File encryption
gpg -c file #encrypts file
gpg file.gpg #decrypts file
Vim has builtin encryption (simple like pkzip).
Use ':X' to encrypt your file. Enter a blank
password to save a decrypted copy again.
--
More information about the ILUG
mailing list