~loggerhead-team/loggerhead/trunk-rich

167 by Michael Hudson
make serve-branches.py executable
1
#!/usr/bin/env python
174 by Michael Hudson
misc logging improvements:
2
import logging
165.1.4 by Michael Hudson
change serve-branches.py to be easier to document :)
3
import sys
4
5
from paste import httpserver
6
from paste.httpexceptions import HTTPExceptionHandler
7
from paste.translogger import TransLogger
8
159.2.25 by Michael Hudson
put things closer to where they belong
9
from loggerhead.apps.filesystem import BranchesFromFileSystemRoot
165.1.4 by Michael Hudson
change serve-branches.py to be easier to document :)
10
174 by Michael Hudson
misc logging improvements:
11
12
logging.basicConfig()
13
logging.getLogger().setLevel(logging.DEBUG)
14
165.1.4 by Michael Hudson
change serve-branches.py to be easier to document :)
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)
159.2.25 by Michael Hudson
put things closer to where they belong
31
159.2.34 by Michael Hudson
doh
32
#from paste.evalexception import EvalException
33
#app = EvalException(app)
159.2.25 by Michael Hudson
put things closer to where they belong
34
165.1.4 by Michael Hudson
change serve-branches.py to be easier to document :)
35
httpserver.serve(app, host='0.0.0.0', port='8080')