def main():
parser = argparse.ArgumentParser(description='') # @TODO fill in
# server options
parser.add_argument('-host', '--host', default="localhost", help='host for the server')
parser.add_argument('-p', '--port', default=8080, help='port for the server')
parser.add_argument('--debug', action='store_true', dest="debug", help='Debug mode (autoreloads the server)')
parser.add_argument('--server', default="auto", help='Server backend to use (see http://bottlepy.org/docs/dev/deployment.html#switching-the-server-backend)')
# elasticsearch options
parser.add_argument('--es-host', default="localhost", help='host for the elasticsearch instance')
parser.add_argument('--es-port', default=9200, help='port for the elasticsearch instance')
parser.add_argument('--es-url-prefix', default='', help='Elasticsearch url prefix')
parser.add_argument('--es-use-ssl', action='store_true', help='Use ssl to connect to elasticsearch')
parser.add_argument('--es-index', default='charitysearch', help='index used to store charity data')
parser.add_argument('--es-type', default='charity', help='type used to store charity data')
args = parser.parse_args()
app.config["es"] = Elasticsearch(
host=args.es_host,
port=args.es_port,
url_prefix=args.es_url_prefix,
use_ssl=args.es_use_ssl
)
app.config["es_index"] = args.es_index
app.config["es_type"] = args.es_type
bottle.debug(args.debug)
bottle.run(app, server=args.server, host=args.host, port=args.port, reloader=args.debug)
评论列表
文章目录