fcgi.py

Victor Muslin victor at prodigy.net
Fri Dec 29 06:23:09 CET 2000


Well, my most important need was not to have to open database connections every
time CGI executed. Currently I don't need multiple instances of the script
running simultaneously. If and when I do, I plan to add multithreading to my
FastCGI library (I actually believe it had already been done).

I got it running so far with cgi-fcgi.exe bridge. Though it has to fork/exec
cgi-fcgi program every time, it is still an order of magnitude faster than
opening ODBC connection. To get it running on NT, I modified (very slightly)
Robin Dunn's fcgi.py and built fcgi2.py on top of it that uses a socket instead
of a named pipe. You can get my modules at
http://pages.prodigy.net/victor/fcgi2_py. Please report any bugs to me (and
perhaps how to fix them since I am still rather new to Python).

I am yet to attempt to use mod_fcgi (I am new to Apache as well). This is my
next step once I figure out how to configure Apache on WinNT for it (any help is
appreciated :-). Once I get this working I plan to try either mod_python or
mod_snake (any help for configuring Apache with those is appreciated as well :).

On 28 Dec 2000 09:43:57 GMT, bernhard at abnoba.intevation.de (Bernhard Reiter)
wrote:

>In article <3a4a90ab.1328483109 at localhost>,
>	victor at prodigy.net (Victor Muslin) writes:
>
>> I just found an old posting that says that socket.fromfd() is not
>> implemented on Windows platform (though Python documentation does not
>> say so). Is there a FastCGI solution for Python for WindowsNT???
>
>Not that I know of. :(
>I ran into the same problem and the solution to fix fcgi.py to use
>named pipes under WindowsNT is not trivial. Just peek at the mod_fastcgi
>sources themself to see what tricks they have to pull under WindowsNT.
>(Another problem is that the versions of apache I have tried under
>WindowsNT all were buggy regarding fcgi. They did not even run with
>the fastcgi c examples and error reporting was lousy.)
>
>The part of fcgi and apache that you want of course is the
>dynamic capabilities of apache to create as many fcgi instances as
>needed. Fortunatly there seems to be another solution, which still
>stands to be tested here:
>
>Use mod_python with apache and program your python script in a way
>that it will do most of its stuff when importing the modules onces.
>Then subsequent calls in the same apache thread will be in the same
>name space of the python subinterpreter. So you can use the apache
>thread load balancing of the server and answer multiple requests
>fast.
>
>Let me know if you find out more!
>	Bernhard




More information about the Python-list mailing list