1 #!/usr/bin/env python 2 3 from WebStack.Adapters.BaseHTTPRequestHandler import deploy 4 from WebStack.Resources.ResourceMap import MapResource 5 from WebStack.Resources.Static import DirectoryResource 6 from PEP241 import PEP241Resource 7 import os 8 9 # Get the directory of the application. 10 11 pep241_resource = PEP241Resource() 12 directory = pep241_resource.resource_dir 13 14 # Make a simple Web site. 15 16 resource = MapResource({ 17 # Static resources: 18 "styles" : DirectoryResource(os.path.join(directory, "styles"), {"css" : "text/css"}), 19 # Main page: 20 "" : pep241_resource 21 }) 22 23 # Special magic incantation. 24 25 print "Serving..." 26 deploy(resource, handle_errors=0) 27 28 # vim: tabstop=4 expandtab shiftwidth=4