[Pythonmac-SIG] testing HTML with Python
bob at redivi.com
Tue Sep 16 17:06:30 EDT 2003
On Tuesday, Sep 16, 2003, at 16:40 America/New_York, Jack Jansen wrote:
>>> Ive got a tool that I have developed with python on iMac where the
>>> user inputs text into an HTML page & my Python program(also
>>> the CGI) executes it to produce a certain layout in association with
>>> I need to test it. is there a way I could do that locally on my iMac
>>> OS X?without up loading it to a server?
>> I'm a little confused (admittedly, I didn't think about it very hard
>> :-), but you know that OS X comes with Apache, right?
> S/he probably didn't, having said "This is the first time I work with
>> "Personal Web Sharing" in the "Sharing" panel of System Preferences
>> and point your browser at 127.0.0.1.
> But I seem to remember that someone reported here that getting Python
> CGI scripting to work with the included Apache was a bit of work.
> Do I remember right? Can anyone post the details again?
I don't see why any script marked +x sitting in
/Library/WebServer/CGI-Executables wouldn't Just Work.. I see in
/etc/httpd/httpd.conf (with the non-relevant parts stripped):
LoadModule cgi_module libexec/httpd/mod_cgi.so
LoadModule alias_module libexec/httpd/mod_alias.so
ScriptAlias /cgi-bin/ "/Library/WebServer/CGI-Executables/"
Allow from all
Of course if you want .cgi programs to be executable elsewhere, you
need to uncomment (from the <IfModule mod_mime.c> block):
AddHandler cgi-script .cgi
If you end up making this change, you will surely have to restart
Apache (sudo /usr/sbin/apachectl restart).
Of course, httpd.conf needs to be modified as root (sudo vi
/etc/httpd/httpd.conf).. but anyone with admin group should be able to
just dump executables into /Library/WebServer/CGI-Executables.
Maybe the "bit of work" referred to compiling mod_python.. which was a
pain in the ass from what I remember (I think I did it back in 10.1),
but I haven't even tried to use mod_python since I learned Twisted.
More information about the Pythonmac-SIG