diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-10-09 18:18:23 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-10-09 18:18:23 +0200 |
commit | 57cce481460efd7c9897c59652b544ef65063837 (patch) | |
tree | d3e8f4d1465e32c20028258d941c7eb56f15943d /module/web/webinterface.py | |
parent | add filejungle.com, fix sharerapid.com (diff) | |
download | pyload-57cce481460efd7c9897c59652b544ef65063837.tar.xz |
updated js/mootools, some parts now coffeescript
Diffstat (limited to 'module/web/webinterface.py')
-rw-r--r-- | module/web/webinterface.py | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/module/web/webinterface.py b/module/web/webinterface.py index 8f814715f..b531d0583 100644 --- a/module/web/webinterface.py +++ b/module/web/webinterface.py @@ -66,7 +66,7 @@ if PREFIX: if not PREFIX.startswith("/"): PREFIX = "/" + PREFIX -DEBUG = config.get("general","debug_mode") or "-d" in sys.argv or "--debug" in sys.argv +DEBUG = config.get("general", "debug_mode") or "-d" in sys.argv or "--debug" in sys.argv bottle.debug(DEBUG) cache = join("tmp", "jinja_cache") @@ -75,9 +75,12 @@ if not exists(cache): bcc = FileSystemBytecodeCache(cache, '%s.cache') loader = PrefixLoader({ - "default": FileSystemLoader(join(PROJECT_DIR, "templates", "default")) - }) -env = Environment(loader=loader, extensions=['jinja2.ext.i18n'], trim_blocks=True, auto_reload=False, bytecode_cache=bcc) + "default": FileSystemLoader(join(PROJECT_DIR, "templates", "default")), + 'js': FileSystemLoader(join(PROJECT_DIR, 'media', 'js')) +}) + +env = Environment(loader=loader, extensions=['jinja2.ext.i18n'], trim_blocks=True, auto_reload=False, + bytecode_cache=bcc) from filters import quotepath, path_make_relative, path_make_absolute, truncate, date @@ -89,14 +92,14 @@ env.filters["path_make_absolute"] = path_make_absolute env.filters["decode"] = decode env.filters["type"] = lambda x: str(type(x)) env.filters["formatsize"] = formatSize -env.filters["getitem"] = lambda x,y: x.__getitem__(y) +env.filters["getitem"] = lambda x, y: x.__getitem__(y) if PREFIX: env.filters["url"] = lambda x: x else: env.filters["url"] = lambda x: PREFIX + x if x.startswith("/") else x translation = gettext.translation("django", join(PYLOAD_DIR, "locale"), - languages=["en", config.get("general","language")]) + languages=["en", config.get("general", "language")]) translation.install(True) env.install_gettext_translations(translation) @@ -125,11 +128,14 @@ import api_app def run_simple(host="0.0.0.0", port="8000"): run(app=web, host=host, port=port, quiet=True) + def run_lightweight(host="0.0.0.0", port="8000"): run(app=web, host=host, port=port, quiet=True, server="bjoern") + def run_threaded(host="0.0.0.0", port="8000", theads=3, cert="", key=""): from wsgiserver import CherryPyWSGIServer + if cert and key: CherryPyWSGIServer.ssl_certificate = cert CherryPyWSGIServer.ssl_private_key = key @@ -137,10 +143,13 @@ def run_threaded(host="0.0.0.0", port="8000", theads=3, cert="", key=""): CherryPyWSGIServer.numthreads = theads from utils import CherryPyWSGI + run(app=web, host=host, port=port, server=CherryPyWSGI, quiet=True) + def run_fcgi(host="0.0.0.0", port="8000"): from bottle import FlupFCGIServer + run(app=web, host=host, port=port, server=FlupFCGIServer, quiet=True) |