(For gurus) Embed functions in webpages like in PHP?
guettli at thomas-guettler.de
Fri Apr 16 15:09:40 CEST 2004
Am Fri, 16 Apr 2004 12:38:16 +0200 schrieb Robert Ferber:
> I'm a PHP-programmer who evaluates Python for a new project.
> I really like a lot of concepts of Python, especially the shell, but there
> is one great feature of PHP which I don't know how to replace in Python:
> For database-intensive webpages, I like to cache the HTML-output on the fly
> in the filesystem and put out the file later whenever the same URL is
> requested again, for example:
The problem with caching: When is
the data outdate?
You could use this approach:
Run a cron-job every hour which does the complicated
query which needs long to compute. Dump
the result into a file (Look for "pickle"
in the module index of the docs).
Load this file for every request
and insert this into the template.
More information about the Python-list