~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to serve-branches.py

  • Committer: Michael Hudson
  • Date: 2008-06-25 06:18:13 UTC
  • mfrom: (174.1.8 streaming)
  • Revision ID: michael.hudson@canonical.com-20080625061813-3cr5iax8sdz0e67s
merge my streaming branch which:
 * most importantly, streams the pages as they render to the client, which 
   reduces memory usage on large pages and feels better for the user
 * makes the stuff in controller/ have a more wsgi-ish interface
 * restores the stripping of excess whitespace from the output

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
import logging
 
3
import sys
 
4
 
 
5
from paste import httpserver
 
6
from paste.httpexceptions import HTTPExceptionHandler
 
7
from paste.translogger import TransLogger
 
8
 
 
9
from loggerhead.apps.filesystem import BranchesFromFileSystemRoot
 
10
 
 
11
 
 
12
logging.basicConfig()
 
13
logging.getLogger().setLevel(logging.DEBUG)
 
14
 
 
15
if len(sys.argv) > 1:
 
16
    path = sys.argv[1]
 
17
else:
 
18
    path = '.'
 
19
 
 
20
app = BranchesFromFileSystemRoot(path)
 
21
 
 
22
app = HTTPExceptionHandler(app)
 
23
app = TransLogger(app)
 
24
 
 
25
try:
 
26
    from paste.deploy.config import PrefixMiddleware
 
27
except ImportError:
 
28
    pass
 
29
else:
 
30
    app = PrefixMiddleware(app)
 
31
 
 
32
#from paste.evalexception import EvalException
 
33
#app = EvalException(app)
 
34
 
 
35
httpserver.serve(app, host='0.0.0.0', port='8080')