CGI with Python

lynx a at b.c
Sat Sep 16 18:10:12 EDT 2000


paralizer at my-deja.com, in <8q05q6$vnf$1 at nnrp1.deja.com>:

> Anyway, I still do not know how to run .pyc on the Apache...

you can't, really, because the .pyc is not executable on its own.

if you have the .py file, and the python interpreter, then configure
apache to execute .py files as CGI scripts and make sure the hash-bang
header on the scripts start python correctly; the interpreter will
(should, AFAIK) notice the corresponding .pyc files and use them to
speed up loading and initializing. (i could be wrong about this.
corrections from wiser people welcomed.)

there are tricks designed to run .pyc files on their own without the
.py file, but the only one i've seen posted here recently didn't work
for me, and i'm not skilled enough to fix whatever was wrong with it.
if you really, really don't want to distribute the .py file, then your
best bet is probably the "freeze" utility; yes, it produces very large
executables, but you can't escape that overhead anyway (without leaving
python behind entirely, that is).

as for how to configure apache, you might do better to ask in the
relevant apache newsgroup, or get the O'Reilly book on apache. i hear
the "comanche" web-based configuration utility is supposed to be good,
though i've not tried it yet.



More information about the Python-list mailing list