diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-06-28 20:20:16 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-06-28 20:20:16 +0200 |
commit | b6630d2c4d0b4b511282e228530ea6053647d48c (patch) | |
tree | 49f2a295d65eb82875cc0fa2781ae630cf5459b3 /module/web | |
parent | [Webui] Notify update version when a pyload update is available (diff) | |
download | pyload-b6630d2c4d0b4b511282e228530ea6053647d48c.tar.xz |
Improve web server choosing
Diffstat (limited to 'module/web')
-rw-r--r-- | module/web/ServerThread.py | 54 | ||||
-rw-r--r-- | module/web/webinterface.py | 2 |
2 files changed, 28 insertions, 28 deletions
diff --git a/module/web/ServerThread.py b/module/web/ServerThread.py index 84667e5f6..451517d71 100644 --- a/module/web/ServerThread.py +++ b/module/web/ServerThread.py @@ -30,45 +30,45 @@ class WebServer(threading.Thread): import webinterface global webinterface - if self.https: - if not exists(self.cert) or not exists(self.key): - log.warning(_("SSL certificates not found.")) - self.https = False + reset = False + + if self.https and (not exists(self.cert) or not exists(self.key)): + log.warning(_("SSL certificates not found.")) + self.https = False if self.server in ("lighttpd", "nginx"): log.warning(_("Sorry, we dropped support for starting %s directly within pyLoad") % self.server) log.warning(_("You can use the threaded server which offers good performance and ssl,")) log.warning(_("of course you can still use your existing %s with pyLoads fastcgi server") % self.server) log.warning(_("sample configs are located in the module/web/servers directory")) - self.server = "builtin" - - if self.server == "fastcgi": + reset = True + elif self.server == "fastcgi": try: import flup except: log.warning(_("Can't use %(server)s, python-flup is not installed!") % { "server": self.server}) - self.server = "builtin" - elif self.server == "lightweight": - try: - import bjoern - except Exception, e: - log.error(_("Error importing lightweight server: %s") % e) - log.warning(_("You need to download and compile bjoern, https://github.com/jonashaag/bjoern")) - log.warning(_("Copy the boern.so to module/lib folder or use setup.py install")) - log.warning(_("Of course you need to be familiar with linux and know how to compile software")) - self.server = "builtin" - - if os.name == "nt": - self.core.log.info(_("Server set to threaded, due to known performance problems on windows.")) - self.core.config['webinterface']['server'] = "threaded" - self.server = "threaded" - - - if self.server == "fastcgi": - self.start_fcgi() - elif self.server == "threaded": + reset = True + + if reset or self.server == "lightweight": + if os.name != "nt": + try: + import bjoern + except Exception, e: + log.error(_("Error importing lightweight server: %s") % e) + log.warning(_("You need to download and compile bjoern, https://github.com/jonashaag/bjoern")) + log.warning(_("Copy the boern.so to module/lib folder or use setup.py install")) + log.warning(_("Of course you need to be familiar with linux and know how to compile software")) + self.server = "builtin" + else: + self.core.log.info(_("Server set to threaded, due to known performance problems on windows.")) + self.core.config['webinterface']['server'] = "threaded" + self.server = "threaded" + + if self.server == "threaded": self.start_threaded() + elif self.server == "fastcgi": + self.start_fcgi() elif self.server == "lightweight": self.start_lightweight() else: diff --git a/module/web/webinterface.py b/module/web/webinterface.py index af4b9417f..21a23bbc0 100644 --- a/module/web/webinterface.py +++ b/module/web/webinterface.py @@ -130,7 +130,7 @@ def run_simple(host="0.0.0.0", port="8000"): def run_lightweight(host="0.0.0.0", port="8000"): - run(app=web, host=host, port=port, quiet=True, server="bjoern") + run(app=web, host=host, port=port, server="bjoern", quiet=True) def run_threaded(host="0.0.0.0", port="8000", theads=3, cert="", key=""): |