summaryrefslogtreecommitdiffstats
path: root/module/web/ServerThread.py
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2009-12-21 23:03:12 +0100
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2009-12-21 23:03:12 +0100
commitf6af404831d166412f2aa507636ed2825e0e4c0d (patch)
tree2e6c9f6fa194125769f83789696b74b3a6c76e3b /module/web/ServerThread.py
parentlog view, progressbar test (diff)
downloadpyload-f6af404831d166412f2aa507636ed2825e0e4c0d.tar.xz
webserver for win
Diffstat (limited to 'module/web/ServerThread.py')
-rw-r--r--module/web/ServerThread.py27
1 files changed, 19 insertions, 8 deletions
diff --git a/module/web/ServerThread.py b/module/web/ServerThread.py
index 2ac39c2c8..0d6044562 100644
--- a/module/web/ServerThread.py
+++ b/module/web/ServerThread.py
@@ -17,16 +17,27 @@ class WebServer(threading.Thread):
def run(self):
host = self.pycore.config['webinterface']['host']
port = self.pycore.config['webinterface']['port']
+ command = ['python',join(self.pycore.path,"module","web","manage.py"), "runserver", "%s:%s" % (host,port)]
self.pycore.logger.info("Starting Webserver: %s:%s" % (host,port) )
- self.p = Popen(['python',join(self.pycore.path,"module","web","manage.py"), "runserver", "%s:%s" % (host,port)], close_fds=True, stderr=PIPE, stdin=PIPE, stdout=PIPE)
- #os.system("python " + join(self.pycore.path,"module","web","manage.py runserver %s:%s" % (host,port)))
- #@TODO: better would be real python code
- sleep(1)
- with open("webserver.pid", "r") as f:
- self.pid = int(f.read().strip())
- while self.running:
+
+ if os.name == 'posix':
+ self.p = Popen(command, close_fds=True, stderr=PIPE, stdin=PIPE, stdout=PIPE)
+ #os.system("python " + join(self.pycore.path,"module","web","manage.py runserver %s:%s" % (host,port)))
+ #@TODO: better would be real python code
sleep(1)
+ with open("webserver.pid", "r") as f:
+ self.pid = int(f.read().strip())
+ while self.running:
+ sleep(1)
+ else:
+ self.p = Popen(command, stderr=PIPE, stdin=PIPE, stdout=PIPE)
+ while self.running:
+ sleep(1)
def quit(self):
- os.kill(self.pid, SIGINT)
+ if os.name == 'posix':
+ os.kill(self.pid, SIGINT)
+ else:
+ self.p.kill()
+
self.running = False