def run(self): self.version = '0.2.0' logger.info("Version: " + self.version) # init core parts self.core = Core(); self.database = Database() # init other managers self.adapters = AdapterManager() self.devices = DeviceManager() self.plugins = PluginManager() # load plugins # TODO: load plugins from config self.plugins.load("History") self.plugins.load("Echo") #self.plugins.load("Websocket") # init complete logger.debug("App initialized. PID: " + str(os.getpid())) try: # start components components.start() logger.info("All compnents started") # start router / blocking call self.core.run() finally: self.shutdown()
from reactor.components.database import Base from sqlalchemy import create_engine, ForeignKey from sqlalchemy import Column, Date, Integer, String from sqlalchemy.orm import relationship, backref DB_DIR = "../db" class Cache(Base): """""" __tablename__ = "cache" id = Column(Integer, primary_key=True) module = Column(String) key = Column(String) value = Column(String) if __name__ == '__main__': logger.info("DB Install started") # create db paths if not os.path.exists(DB_DIR): os.makedirs(DB_DIR) # setup engine db = Database() # create all tables Base.metadata.create_all(db.engine) logger.info("DB Install finished")
from sqlalchemy import Column, Date, Integer, String from sqlalchemy.orm import relationship, backref DB_DIR = "./db" class Cache(Base): """""" __tablename__ = "cache" id = Column(Integer, primary_key=True) module = Column(String) key = Column(String) value = Column(String) if __name__ == '__main__': logger.info("DB Install started") # create db paths if not os.path.exists(DB_DIR): os.makedirs(DB_DIR) # setup engine db = Database() # create all tables Base.metadata.create_all(db.engine) logger.info("DB Install finished") logger.info("Seeding data")