import sys import optparse import ConfigParser opt_parser = optparse.OptionParser() opt_parser.add_option('-p', '--port', dest='port', action='store', default=8888, help='') opt_parser.add_option('-c', '--config', dest='config', action='store', default=None, help='') opt_parser.add_option('-s', '--section', dest='sect', action='store', default='whosonfirst', help='') opt_parser.add_option('-v', '--verbose', dest='verbose', action='store_true', default=False, help='Be chatty (default is false)') options, args = opt_parser.parse_args() if options.verbose: logging.basicConfig(level=logging.DEBUG) else: logging.basicConfig(level=logging.INFO) if not os.path.exists(options.config): logging.error("Missing config file") sys.exit() cfg = ConfigParser.ConfigParser() cfg.read(options.config) dsn = spatial.cfg2dsn(cfg, options.sect) os.environ['WOF_SPATIAL_DSN'] = dsn port = int(options.port) app.run(port=port)
import optparse import ConfigParser opt_parser = optparse.OptionParser() opt_parser.add_option('-p', '--port', dest='port', action='store', default=7777, help='') opt_parser.add_option('-c', '--config', dest='config', action='store', default=None, help='') opt_parser.add_option('-v', '--verbose', dest='verbose', action='store_true', default=False, help='Be chatty (default is false)') options, args = opt_parser.parse_args() if options.verbose: logging.basicConfig(level=logging.DEBUG) else: logging.basicConfig(level=logging.INFO) cfg = ConfigParser.ConfigParser() cfg.read(options.config) dsn = spatial.cfg2dsn(cfg, 'spatial') os.environ['WOF_SPATIAL_DSN'] = dsn os.environ['WOF_SEARCH_HOST'] = cfg.get('search', 'host') os.environ['WOF_SEARCH_PORT'] = cfg.get('search', 'port') port = int(options.port) app.config["APPLICATION_ROOT"] = "/spelunker" app.run(port=port)
dest='sect', action='store', default='whosonfirst', help='') opt_parser.add_option('-v', '--verbose', dest='verbose', action='store_true', default=False, help='Be chatty (default is false)') options, args = opt_parser.parse_args() if options.verbose: logging.basicConfig(level=logging.DEBUG) else: logging.basicConfig(level=logging.INFO) if not os.path.exists(options.config): logging.error("Missing config file") sys.exit() cfg = ConfigParser.ConfigParser() cfg.read(options.config) dsn = spatial.cfg2dsn(cfg, options.sect) os.environ['WOF_SPATIAL_DSN'] = dsn port = int(options.port) app.run(port=port)