http knowledge sought

Graham Fawcett graham__fawcett at hotmail.com
Wed Jun 23 02:37:39 EDT 2004


"Elaine Jackson" <elainejackson7355 at home.com> wrote in message news:<6r3Cc.861817$Ig.9977 at pd7tw2no>...
> I want to run an http server but I don't know how to get started. I've read
> through the documentation for the relevant modules, but I don't have enough http
> knowledge to get the initial spark I need, and I can't seem to track down the
> knowledge in question on the web or at the library. Maybe somebody can point me
> toward some resources?


What is it you're trying to accomplish, Elaine? There are a number of
ways to write a Web server in Python, but how you intend to use that
server will determine which ways are most appropriate.

Probably the easiest HTTP server to write in Python is:

  import SocketServer
  import SimpleHTTPServer

  handler_class = SimpleHTTPServer.SimpleHTTPRequestHandler
  ss = SocketServer.TCPServer( ('', 80), handler_class)
  ss.serve_forever()

which will run a Web server, serving up files from the current
directory (the one from which you ran the program above). Run the
program, and visit http://localhost/ to see your server in action.

But chances are that's not what you need. You'll find the folks on
this list are tremendously helpful, but aren't much use unless you're
clear about what your end-goals are. Please elaborate!


> In case you feel like answering a specific question, here's one: How does http
> addressing work? I remember reading in a book about dot-separated quadruples of
> numerals, written in decimal but required to be two hexadecimal digits long.
> Problem is, I can't get hold of that book right now.

Erm, it sounds like you're thinking about Internet Protocol (IP)
addressing, which is more fundamental than HTTP. TCP and IP are the
foundational protocols upon which HTTP is built; but so are FTP,
telnet, SMTP (e-mail), etc.

Google for "internet protocol tutorial" to learn more about IP
addresses.

-- Graham



More information about the Python-list mailing list