What's new? | Help | Directory | Sign in
Google
gears
Improving Your Web Browser
  
  
  
    
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import os
import sys
import BaseHTTPServer
import SimpleHTTPServer

def main():
# If present, argv[1] is the directory to use as the localhost root.
if len(sys.argv) > 1:
os.chdir(sys.argv[1])

print '''
Started HTTP server. http://localhost/... maps to:
%s%s...
Press Ctrl-Break or Ctrl-C to exit.
''' % (os.getcwd(), os.sep)

server_class = BaseHTTPServer.HTTPServer
handler_class = SimpleHTTPServer.SimpleHTTPRequestHandler

server_addr = ('', 80)
httpd = server_class(server_addr, handler_class)
httpd.serve_forever()

if __name__ == '__main__':
main()
Show details Hide details

Change log

r186 by gears.daemon on Aug 07, 2007   Diff
[Author: cprince]

Support mapping localhost root to another
directory.

R=aa
CC=google-gears-eng@googlegroups.com
DELTA=8  (5 added, 0 deleted, 3 changed)
OCL=5175606
SCL=5181496
Go to: 
Project members, sign in to write a code review

Older revisions

r184 by gears.daemon on Aug 07, 2007   Diff
[Author: cprince]

Add script for running a
http://localhost/ web server.

...
All revisions of this file

File info

Size: 582 bytes, 25 lines

File properties

svn:executable
*