modifié: m/fichier/conf

modifié:         superTornado.py
This commit is contained in:
sidya82 2014-03-02 23:20:31 +01:00
parent c4c9b6c5f6
commit eea71d3b78
2 changed files with 14 additions and 10 deletions

View File

@ -1,3 +1,3 @@
blind=1 blind=1
camera=192 camera=192.168.1.13
port=80 port=80

View File

@ -20,8 +20,12 @@ import os
config = LoadConf() config = LoadConf()
blind = False
cam = ""
port =""
ficLog = Log() ficLog = Log()
class BaseHandler(tornado.web.RequestHandler): class BaseHandler(tornado.web.RequestHandler):
def get_current_user(self): def get_current_user(self):
return self.get_secure_cookie("user") return self.get_secure_cookie("user")
@ -151,26 +155,26 @@ application = tornado.web.Application([
if __name__ == "__main__": if __name__ == "__main__":
print "->Loading configuration ... " print "->Loading configuration ... "
try : try :
confAveug = config.isBlind blind = config.isBlind
ipCamera = config.ipCamera cam = config.ipCamera
portServ = config.portServ port = config.portServ
if confAveug == "error" : if blind == "error" :
raise "Failed Load Blind Configuration" raise "Failed Load Blind Configuration"
if ipCamera == "error" : if cam == "error" :
raise "Failed Load IP Camera Configuration" raise "Failed Load IP Camera Configuration"
if portServ == "error" : if port == "error" :
raise "Failed Load Port Server Configuration" raise "Failed Load Port Server Configuration"
except Exception, e : except Exception, e :
print "Configuration Loading Failed ! Check Configuration File !" print "Configuration Loading Failed ! Check Configuration File !"
print e print e
sys.exit(1) sys.exit(1)
print "->Configuration Server Load Successfully:" print "->Configuration Server Load Successfully:"
if confAveug == True: if blind == True:
print " ->Blind unhabitant" print " ->Blind unhabitant"
else : else :
print " ->Not blind unhabitant" print " ->Not blind unhabitant"
print " ->Ip camera : " + ipCamera print " ->Ip camera : " + cam
print " ->Port Server : " + portServ print " ->Port Server : " + port
tornado.options.parse_command_line() tornado.options.parse_command_line()
http_server = tornado.httpserver.HTTPServer(application) http_server = tornado.httpserver.HTTPServer(application)