summaryrefslogtreecommitdiffstats
path: root/module/web/ServerThread.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/web/ServerThread.py')
-rw-r--r--module/web/ServerThread.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/module/web/ServerThread.py b/module/web/ServerThread.py
index 2279296d8..d9f0f8cdc 100644
--- a/module/web/ServerThread.py
+++ b/module/web/ServerThread.py
@@ -4,6 +4,7 @@ from os.path import join
from subprocess import Popen, PIPE, STDOUT
from time import sleep
from signal import SIGINT
+import os
class WebServer(threading.Thread):
def __init__(self, pycore):
@@ -16,12 +17,15 @@ class WebServer(threading.Thread):
host = self.pycore.config['webinterface']['host']
port = self.pycore.config['webinterface']['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, shell=True)
+ 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:
sleep(1)
def quit(self):
- self.p.terminate()
+ os.kill(self.pid, SIGINT)
self.running = False