# HG changeset patch # User paulb # Date 1115060080 0 # Node ID a65d768d71e91edaa0da6bc9e0b06c7c83cd728f # Parent 9179ac2a716f0547ad54f1faddc8051e2d935a63 [project @ 2005-05-02 18:54:40 by paulb] Made use of WebStack 0.9 deployment techniques and the MapResource, along with a later static resource publishing mechanism so that the stylesheet is not handled in the application itself. diff -r 9179ac2a716f -r a65d768d71e9 examples/BaseHTTPRequestHandler/ConfiguratorApp.py --- a/examples/BaseHTTPRequestHandler/ConfiguratorApp.py Mon May 02 18:53:36 2005 +0000 +++ b/examples/BaseHTTPRequestHandler/ConfiguratorApp.py Mon May 02 18:54:40 2005 +0000 @@ -1,15 +1,25 @@ #!/usr/bin/env python -from WebStack.Adapters import BaseHTTPRequestHandler -from Configurator import ConfiguratorResource -import BaseHTTPServer +from WebStack.Adapters.BaseHTTPRequestHandler import deploy +from WebStack.Resources.ResourceMap import MapResource +from WebStack.Resources.Static import DirectoryResource +import Configurator +import os + +# Get the directory of the application. + +directory = os.path.split(Configurator.__file__)[0] + +# Make a simple Web site. + +resource = MapResource({ + "styles" : DirectoryResource(os.path.join(directory, "Resources", "styles"), {"css" : "text/css"}), + None : Configurator.ConfiguratorResource() + }) # Special magic incantation. -handler = BaseHTTPRequestHandler.HandlerFactory(ConfiguratorResource()) -address = ("", 8080) -server = BaseHTTPServer.HTTPServer(address, handler) print "Serving..." -server.serve_forever() +deploy(resource, handle_errors=0) # vim: tabstop=4 expandtab shiftwidth=4