[Python编程(第4版)].(Programming.Python.4th.Edition).Mark.Lutz.文字版

(yzsuai) #1

scripts locally with server name “localhost” before deploying them on a real remote
server. If you wish to install and run the examples under a different web server, you’ll
want to extrapolate the examples for your context. Things like server names and path-
names in URLs, as well as CGI script filename extensions and other conventions, can
vary widely; consult your server’s documentation for more details. For this chapter and
the next, we’ll assume that you have the webserver.py script running locally.


The Server-Side Examples Root Page


To confirm that you are set up to run the examples, start the web server script in
Example 15-1 and type the following URL in the address field at the top of your web
browser:


http://localhost/PyInternetDemos.html

This address loads a launcher page with links to this chapter’s example files (see the
examples distribution for this page’s HTML source code, which is not listed in this
book). The launcher page itself appears as in Figure 15-1, shown displayed in the In-
ternet Explorer web browser on Windows 7 (it looks similar on other browsers and
platforms). Each major example has a link on this page, which runs when clicked.


Figure 15-1. The PyInternetDemos launcher page


Running Server-Side Examples | 1133
Free download pdf