getting started with cgi on os x

Michael Hudson mwh at python.net
Mon Nov 11 05:09:31 EST 2002


"Stephen Aichele" <stephen at mochamail.com> writes:

> Hello.
> 
> A few years back, I dove into python, and after being away from it
> for a year, I'm looking at using it to build a cgi backend to a
> website.
> 
> I'm new to cgi.  I'm working on a mac running os x.  
> 
> Question #1:  I'm assuming that I need to have a web server up and
> running on my development machine to get cgi pages to display in a
> browser.  Any info on setting up apache or medusa(?) to run python
> cgi scripts on os x would be much appreciated.  I feel a bit lost.

You already have one; poke around in System Preferences.  To execute
CGI scripts, you probably need to put things in 

    ~/Sites/cgi-bin/

and you may need to fiddle /etc/httpd/users/$YOU.conf (or some file
like that).

> Question #2: I'm also assuming that the easiest way to call a python
> cgi script from a web page is via a form 'action'.  I'd really like
> to use javascript to call python cgi scripts/methods , (rather than
> using 'action' from a form ).  My hunch is that this is impossible,
> or at least a pain in the rear.  Am I right?

Not quite sure what you mean... I think you can write js like

  window.location = "http://127.0.0.1/~you/cgi-bin/myscript.py?args=..."

Cheers,
M.

-- 
  On the other hand, the following areas are subject to boycott
  in reaction to the rampant impurity of design or execution, as
  determined after a period of study, in no particular order:
    ...                              http://www.naggum.no/profile.html



More information about the Python-list mailing list