~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to start-loggerhead.py

[rs=mwhudson][release-critical=Rinchen] update to loggerhead trunk,
        mainly to get the code to not hold branches open the whole time but
        also getting some other improvements

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 
3
3
import logging
4
4
import logging.handlers
 
5
from optparse import OptionParser
5
6
import os
6
7
import sys
7
 
from optparse import OptionParser
 
8
import urlparse
8
9
 
9
10
from configobj import ConfigObj
10
11
 
49
50
    access_log.setLevel(logging.INFO)
50
51
    access_log.setFormatter(f)
51
52
 
 
53
    logging.getLogger('').setLevel(logging.DEBUG)
52
54
    logging.getLogger('').addHandler(debug_log)
53
 
    logging.getLogger('turbogears.access').addHandler(access_log)
54
 
    logging.getLogger('turbogears.controllers').setLevel(logging.INFO)
 
55
    logging.getLogger('wsgi').addHandler(access_log)
55
56
 
56
57
    if foreground:
57
58
        logging.getLogger('').addHandler(stdout_log)
121
122
    app = make_filter(app, None)
122
123
 
123
124
    if webpath:
124
 
        if not webpath.endswith('/'):
125
 
            webpath += '/'
126
 
        def app(environ, start_response, app=app):
127
 
            environ['SCRIPT_NAME'] = webpath
128
 
            return app(environ, start_response)
 
125
        scheme, netloc, path, blah, blah, blah = urlparse.urlparse(webpath)
 
126
        def app(environ, start_response, orig=app):
 
127
            environ['SCRIPT_NAME'] = path
 
128
            environ['HTTP_HOST'] = netloc
 
129
            return orig(environ, start_response)
129
130
 
130
131
    try:
131
132
        httpserver.serve(