1st argument for -u web is the base dir

This commit is contained in:
Martijn Voncken 2008-10-23 18:11:35 +00:00
parent cb19d71b7d
commit 0896856908
2 changed files with 12 additions and 5 deletions

View File

@ -97,12 +97,15 @@ def WsgiApplication(middleware = None):
return wsgifunc(webpyfunc(pagemanager.urls, pagemanager.page_classes, False), *middleware) return wsgifunc(webpyfunc(pagemanager.urls, pagemanager.page_classes, False), *middleware)
def create_webserver(debug = False): def create_webserver(debug = False, base_url =None):
"starts builtin webserver" "starts builtin webserver"
import web import web
utils.set_config_defaults() utils.set_config_defaults()
config.set('base','') if base_url:
config.set('base', base_url)
else:
config.set('base','')
config.set('disallow',{}) config.set('disallow',{})
utils.apply_config() utils.apply_config()
@ -121,8 +124,8 @@ def create_webserver(debug = False):
log.info("http://%s:%d/" % server_address) log.info("http://%s:%d/" % server_address)
return server return server
def run(debug = False): def run(debug = False, base_url = ""):
server = create_webserver(debug) server = create_webserver(debug, base_url)
try: try:
server.start() server.start()
except KeyboardInterrupt: except KeyboardInterrupt:

View File

@ -34,5 +34,9 @@
class WebUI: class WebUI:
def __init__(self, args): def __init__(self, args):
import deluge_webserver import deluge_webserver
deluge_webserver.run(debug = False) if args:
base_url = args[0]
else:
base_url = ""
deluge_webserver.run(debug = False, base_url = base_url)