modifié: m/fichier/conf

modifié:         m/loadConf.py
	modifié:         superTornado.py
This commit is contained in:
sidya82 2014-03-03 00:52:36 +01:00
parent 1f746ecc2b
commit 76ef0554a9
3 changed files with 16 additions and 8 deletions

View File

@ -1,3 +1,8 @@
blind=1 blind=1
camera=192.168.1.13 camera=192.168.1.13
portCamera=80 portCamera=80

View File

@ -3,9 +3,12 @@ class LoadConf(object):
with open("m/fichier/conf", "r") as source : with open("m/fichier/conf", "r") as source :
for ligne in source: for ligne in source:
data = ligne.rstrip('\n\r').split('=') data = ligne.rstrip('\n\r').split('=')
if data[0] in key : try :
source.close() if data[0] in key :
return data[1] source.close()
return data[1]
except Exception, e :
pass
source.close() source.close()
return "error" return "error"

View File

@ -154,7 +154,7 @@ application = tornado.web.Application([
cookie_secret="1213215656") cookie_secret="1213215656")
if __name__ == "__main__": if __name__ == "__main__":
print bcolors.HEADER + "HEADER->Loading configuration ... " + bcolors.ENDC print bcolors.HEADER + "->Loading configuration ... " + bcolors.ENDC
try : try :
blind = config.isBlind() blind = config.isBlind()
ipCamera = config.ipCamera() ipCamera = config.ipCamera()
@ -172,7 +172,7 @@ if __name__ == "__main__":
print bcolors.FAIL + e.value print bcolors.FAIL + e.value
print "Configuration Loading Failed ! Check Configuration File !" + bcolors.ENDC print "Configuration Loading Failed ! Check Configuration File !" + bcolors.ENDC
sys.exit(1) sys.exit(1)
print "->Configuration Server Load Successfully :" print bcolors.OKGREEN + "->Configuration Server Load Successfully :" + bcolors.ENDC
if blind == True: if blind == True:
print " ->Blind unhabitant" print " ->Blind unhabitant"
else : else :
@ -182,12 +182,12 @@ if __name__ == "__main__":
tornado.options.parse_command_line() tornado.options.parse_command_line()
try : try :
print("->Server Start ...") print(bcolors.HEADER + "->Server Start ..."+ bcolors.ENDC)
http_server = tornado.httpserver.HTTPServer(application) http_server = tornado.httpserver.HTTPServer(application)
http_server.listen(portServ) http_server.listen(portServ)
print "->Server Start Successfully !" print bcolors.OKGREEN + "->Server Start Successfully !" + bcolors.ENDC
tornado.ioloop.IOLoop.instance().start() tornado.ioloop.IOLoop.instance().start()
except Exception, e : except Exception, e :
print "Server Start Failed !" print bcolors.FAIL + "Server Start Failed !" + bcolors.ENDC
print e print e
sys.exit(1) sys.exit(1)