| Article: |
Web Apps with Tiger: Getting Started | |
| Subject: | Serving a simple Python Script | |
| Date: | 2005-08-23 00:58:37 | |
| From: | infield | |
|
I my reading the people who use Python really love it. OS X ships with version 2.3.5 out of the box. How about something about setting up apache to serve a python script with an example to get us going.
|
||
Showing messages 1 through 2 of 2.
-
Serving a simple Python Script
2005-09-21 10:24:05 b_hanna [View]
Python is cool :p. The setup is basically the same as php, mind you, you may need to enable other cgi modules to get it to run. From then on just 'import cgi' and get cracking with FieldStorage() --> gives you all the parameters passed to your CGI script. I did a lot of tail /var/log/httpd/error_log but I got it working in the end. Just a little tip, make sure the script runs before you try to run it as cgi, I wasted about half an hour wrestling with the conf file only to find I had a typo in my script!!! :-( Oh well. A good test is to manually test the script by directly putting the parameters in the URL(i.e.localhost/mypycgi.cgi?name=Ronald%McDonald) and getting python to print out the parameters, from then on your in python land and can stop sweating about the server.
-
Serving a simple Python Script
2005-09-21 10:24:02 b_hanna [View]
Python is cool :p. The setup is basically the same as php, mind you, you may need to enable other cgi modules to get it to run. From then on just 'import cgi' and get cracking with FieldStorage() --> gives you all the parameters passed to your CGI script. I did a lot of tail /var/log/httpd/error_log but I got it working in the end. Just a little tip, make sure the script runs before you try to run it as cgi, I wasted about half an hour wrestling with the conf file only to find I had a typo in my script!!! :-( Oh well. A good test is to manually test the script by directly putting the parameters in the URL(i.e.localhost/mypycgi.cgi?name=Ronald%McDonald) and getting python to print out the parameters, from then on your in python land and can stop sweating about the server.


