[Tutor] Python in Apache?

Wesley Chun wesc@deirdre.org
Thu, 24 Jan 2002 21:25:03 -0800 (PST)


On Thu, 24 Jan 2002, Victor R. Cardona wrote:
> On Thu, Jan 24, 2002 at 01:16:06PM -0800, Israel Evans wrote:
> > it tells me this::
> >
> > [Thu Jan 24 08:08:42 2002] [error] [client 127.0.0.1]
> > attempt to invoke directory as script: c:/weblish/cgi-bin
> >
> > [Thu Jan 24 08:11:28 2002] [error] [client 127.0.0.1]
> > couldn't spawn child process: c:/weblish/cgi-bin/test.cgi
>
> Try renaming your cgi script to test.py. I think windows needs the ".py"
> extension in order to execute the script with the Python interpreter.

israel,

your script definitely works under Unix with Apache, as others have
noted.  i'd try victor's suggestion above as i've never run apache
under Windoze b4.

another thought is that if you don't need the full power of Apache,
you can run a simplistic Python web server using some of the modules
in the standard library.  i know that works for sure!  :-)

for example, here is how you can setup a webserver that can respond to
CGI requests on port 8000 using only one real line of Python!  ;-)

--------------------------------------
#!/bin/env python
from CGIHTTPServer import test
test()
--------------------------------------

good luck, and let us know how you solve your problem!

-wesley

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

"Core Python Programming", Prentice Hall PTR, =A9 2001
    http://starship.python.net/crew/wesc/cpp/

    wesley.j.chun :: wesc@deirdre.org
    cyberweb.consulting : henderson, nv : cyberweb@rocketmail.com
    http://www.roadkill.com/~wesc/cyberweb/