def main(): parser = optparse.OptionParser() parser.add_option('-c', '--config', help='The path to the config file', default=DEFAULT_CONFIG_PATH) parser.add_option('-a', '--address') parser.add_option('-p', '--port', type='int') parser.add_option('--debug', action='store_true') opts, args = parser.parse_args() if args: parser.error("No positional arguments") if not os.path.exists(opts.config): parser.error("Config file not found at '%s'" % opts.config) config.load(opts.config) if opts.address: config.address = opts.address if opts.port: config.port = opts.port if opts.debug: config.debug = opts.debug engine = model.init_db() application = MonitorManagerApplication(engine) application.listen(config.port.value, config.address.value) IOLoop.instance().start()
def main(): """Run python -m monitormanager.model to initialize the database""" config.load("config.yaml") engine = init_db() Base.metadata.create_all(engine)