[Tutor] .cgi or .py for Python CGIs

alan.gauld@bt.com alan.gauld@bt.com
Wed, 12 Dec 2001 12:21:05 -0000


> On  0, Frank Peavy <fpeavy@pop.net> wrote:
> > I have seen references to various CGI scripts and some have 
> > the .cgi extension and some have a .py extension. Which is correct? 

It depends on the Web server in use.

Normally if CGI programs are all stored under a cgi-bin folder then 
the .py extention is used but if the server has been set to execute 
any program ending .cgi regardless of location then .cgi must be used.

In the latter case the program to execute is usually referenced in 
the first line of the .cgi file using something very like the Unix 
hash-bang trick.

Apache and Xitami are the two web servers I know best and they both 
do either form of setup on both Windows and Unixd platforms.


Alan g.