summaryrefslogtreecommitdiffstats
path: root/Mac
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2000-08-25 22:36:13 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>2000-08-25 22:36:13 (GMT)
commitab0280d252fa64d7027d36868989a923a7fcf218 (patch)
tree2ad3f9e0fddc37324dd35eda23dc5b3915dbae8e /Mac
parentbe80fa2f5d0c8365c094edeab4c24905383d18bc (diff)
downloadcpython-ab0280d252fa64d7027d36868989a923a7fcf218.zip
cpython-ab0280d252fa64d7027d36868989a923a7fcf218.tar.gz
cpython-ab0280d252fa64d7027d36868989a923a7fcf218.tar.bz2
How-to document for using Python for CGI scripting. Not complete and untested, but I'm checking it in so it won't get lost.
Diffstat (limited to 'Mac')
-rw-r--r--Mac/Tools/CGI/cgi.html53
1 files changed, 53 insertions, 0 deletions
diff --git a/Mac/Tools/CGI/cgi.html b/Mac/Tools/CGI/cgi.html
new file mode 100644
index 0000000..3dc5dc0
--- /dev/null
+++ b/Mac/Tools/CGI/cgi.html
@@ -0,0 +1,53 @@
+<HTML>
+<HEAD>
+ <META NAME="GENERATOR" CONTENT="Adobe PageMill 3.0 Mac">
+ <TITLE>Creating CGI scripts with MacPython</TITLE>
+</HEAD>
+<BODY>
+
+<H3>Creating CGI scripts with MacPython</H3>
+<BLOCKQUOTE>
+Note: this document is work-in-progress, and not tested.
+</BLOCKQUOTE>
+
+<P>MacPython allows you to use Python as a CGI scripting language
+for your webserver. Moreover, there are some helper applications
+that allow you to write your CGI scripts in the same way as for
+Unix and Windows, i.e. obtaining their arguments from <TT>os.environ</TT>
+and sending their results to <TT>stdout</TT>. MacPython also has
+all the facilities to program CGI scripts in the Macintosh way,
+through AppleEvents, but that falls outside the scope of this
+document (reading the source code for the helper scripts will
+give you an idea about how to do this).</P>
+
+<P>For the purpose of this document we will assume you are using
+Apple's Personal Webserver 1.5, which comes standard with your
+machine as of MacOS 9.</P>
+
+<P>The first step is to start the webserver, you will find it
+in your control panels. Give it a folder to serve documents from,
+and check that it is working by pointing your browser at it.</P>
+
+<P>The next step is to tell the webserver that documents with
+a &quot;.<TT>py</TT>&quot; extension should be served through
+the <TT>PythonCGISlave</TT> helper application. Open the webserver,
+choose Preferences, tab Action, Add, Start on Extension, extension
+&quot;.py&quot;, select application <TT>PythonCGISlave</TT> (which
+lives in <TT>Python:Mac:Tools:CGI</TT>).</P>
+
+<P>The last step is to try it. Put the following script in <TT>Macintosh
+HD:Webpages:hello.py </TT>(assuming your webserver has the default
+settings for its document folder):</P>
+
+<BLOCKQUOTE>
+ <P><CODE>print &quot;Content-type: text/plain&quot;<BR>
+ print<BR>
+ print &quot;Hello world!&quot;<BR>
+ import time<BR>
+ print &quot;Local time is&quot;, time.ctime(time.time())</CODE></P></BLOCKQUOTE>
+
+<P>Point your webbrowser at <A HREF="http://localhost/hello.py">http://localhost/hello.py</A><CODE>
+</CODE>and check whether it works.
+
+</BODY>
+</HTML>