def init_shutdown(self): doorpi.DoorPi().event_handler('OnWebServerStop', __name__) self.keep_running = False if self.sessions: self.sessions.destroy() DoorPiWebRequestHandler.destroy() self.fake_request() doorpi.DoorPi().event_handler.unregister_source(__name__, True)
def init_shutdown(self): doorpi.DoorPi().event_handler('OnWebServerStop', __name__) self.shutdown() if self.sessions: self.sessions.destroy() DoorPiWebRequestHandler.destroy() self.fake_request() doorpi.DoorPi().event_handler.unregister_source(__name__, True)
def start(self): logger.info("Starting WebServer on {}".format(self.own_url)) doorpi.DoorPi().event_handler.register_event('OnWebServerStart', __name__) doorpi.DoorPi().event_handler.register_event('OnWebServerStop', __name__) self.www = os.path.realpath(doorpi.DoorPi().config.get_string_parsed( DOORPIWEB_SECTION, 'www', '!BASEPATH!/../DoorPiWeb')) self.indexfile = doorpi.DoorPi().config.get_string_parsed( DOORPIWEB_SECTION, 'indexfile', 'index.html') self.area_public_name = doorpi.DoorPi().config.get_string_parsed( DOORPIWEB_SECTION, 'public', 'AREA_public') check_config(self.config) logger.info("Serving files from {}".format(self.www)) doorpi.DoorPi().event_handler.register_action( 'OnWebServerStart', WebServerStartupAction(self.serve_forever)) doorpi.DoorPi().event_handler.register_action( 'OnShutdown', WebServerShutdownAction(self.init_shutdown)) doorpi.DoorPi().event_handler('OnWebServerStart', __name__) DoorPiWebRequestHandler.prepare() logger.info("WebServer started") return self
def start(self): doorpi.DoorPi().event_handler.register_event('OnWebServerStart', __name__) doorpi.DoorPi().event_handler.register_event('OnWebServerStop', __name__) self.www = doorpi.DoorPi().config.get_string_parsed( DOORPIWEB_SECTION, 'www', '!BASEPATH!/../DoorPiWeb') self.indexfile = doorpi.DoorPi().config.get_string_parsed( DOORPIWEB_SECTION, 'indexfile', 'index.html') self.loginfile = doorpi.DoorPi().config.get_string_parsed( DOORPIWEB_SECTION, 'loginfile', 'login.html') self.area_public_name = doorpi.DoorPi().config.get_string_parsed( DOORPIWEB_SECTION, 'public', 'AREA_public') # https://raw.githubusercontent.com/motom001/DoorPiWeb/master/ or http://motom001.github.io/DoorPiWeb/ self.online_fallback = doorpi.DoorPi().config.get_string_parsed( DOORPIWEB_SECTION, 'online_fallback', 'http://motom001.github.io/DoorPiWeb') check_config(self.config) doorpi.DoorPi().event_handler.register_action( 'OnWebServerStart', WebServerStartupAction(self.handle_while_not_shutdown)) doorpi.DoorPi().event_handler.register_action( 'OnShutdown', WebServerShutdownAction(self.init_shutdown)) doorpi.DoorPi().event_handler('OnWebServerStart', __name__) DoorPiWebRequestHandler.prepare() return self
def start(self): doorpi.DoorPi().event_handler.register_event('OnWebServerStart', __name__) doorpi.DoorPi().event_handler.register_event('OnWebServerStop', __name__) self.www = os.path.realpath(doorpi.DoorPi().config.get_string_parsed( DOORPIWEB_SECTION, 'www', '!BASEPATH!/../DoorPiWeb')) self.indexfile = doorpi.DoorPi().config.get_string_parsed( DOORPIWEB_SECTION, 'indexfile', 'index.html') self.loginfile = doorpi.DoorPi().config.get_string_parsed( DOORPIWEB_SECTION, 'loginfile', 'login.html') self.area_public_name = doorpi.DoorPi().config.get_string_parsed( DOORPIWEB_SECTION, 'public', 'AREA_public') self.online_fallback = doorpi.DoorPi().config.get_string_parsed( DOORPIWEB_SECTION, 'online_fallback', 'http://motom001.github.io/DoorPiWeb') check_config(self.config) logger.info('Serving files from {}'.format(self.www)) doorpi.DoorPi().event_handler.register_action( 'OnWebServerStart', WebServerStartupAction(self.handle_while_not_shutdown)) doorpi.DoorPi().event_handler.register_action( 'OnShutdown', WebServerShutdownAction(self.init_shutdown)) doorpi.DoorPi().event_handler('OnWebServerStart', __name__) DoorPiWebRequestHandler.prepare() return self
def start(self): doorpi.DoorPi().event_handler.register_event('OnWebServerStart', __name__) doorpi.DoorPi().event_handler.register_event('OnWebServerStop', __name__) self.www = doorpi.DoorPi().config.get_string_parsed(DOORPIWEB_SECTION, 'www', '!BASEPATH!/../DoorPiWeb') self.indexfile = doorpi.DoorPi().config.get_string_parsed(DOORPIWEB_SECTION, 'indexfile', 'index.html') self.loginfile = doorpi.DoorPi().config.get_string_parsed(DOORPIWEB_SECTION, 'loginfile', 'login.html') self.area_public_name = doorpi.DoorPi().config.get_string_parsed(DOORPIWEB_SECTION, 'public', 'AREA_public') # https://raw.githubusercontent.com/motom001/DoorPiWeb/master/ or http://motom001.github.io/DoorPiWeb/ self.online_fallback = doorpi.DoorPi().config.get_string_parsed(DOORPIWEB_SECTION, 'online_fallback', 'http://motom001.github.io/DoorPiWeb') check_config(self.config) doorpi.DoorPi().event_handler.register_action('OnWebServerStart', WebServerStartupAction(self.handle_while_not_shutdown)) doorpi.DoorPi().event_handler.register_action('OnShutdown', WebServerShutdownAction(self.init_shutdown)) doorpi.DoorPi().event_handler('OnWebServerStart', __name__) DoorPiWebRequestHandler.prepare() return self