~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to serve-branches.py

  • Committer: Michael Hudson
  • Date: 2008-06-23 02:23:46 UTC
  • mto: This revision was merged to the branch mainline in revision 171.
  • Revision ID: michael.hudson@canonical.com-20080623022346-z8njyfn6q69or4lo
change serve-branches.py to be easier to document :)

Show diffs side-by-side

added added

removed removed

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