@click.command()<EOL>@click.option('<STR_LIT:-c>', '<STR_LIT>', type=click.Path(exists=True), envvar='<STR_LIT>',<EOL>help='<STR_LIT>')<EOL>@click.option('<STR_LIT>', '<STR_LIT>', default='<STR_LIT:localhost>', help='<STR_LIT>')<EOL>@click.option('<STR_LIT>', '<STR_LIT>', default=<NUM_LIT>, help='<STR_LIT>')<EOL>@click.option('<STR_LIT>', '<STR_LIT>', is_flag=True, help='<STR_LIT>')<EOL>@click.option('<STR_LIT>', '<STR_LIT>', is_flag=True, help='<STR_LIT>')<EOL>@click.pass_context<EOL>def serve(context, config, host, port, debug, livereload):
pymongo_config = dict(<EOL>MONGO_HOST=context.obj['<STR_LIT:host>'],<EOL>MONGO_PORT=context.obj['<STR_LIT:port>'],<EOL>MONGO_DBNAME=context.obj['<STR_LIT>'],<EOL>MONGO_USERNAME=context.obj['<STR_LIT:username>'],<EOL>MONGO_PASSWORD=context.obj['<STR_LIT:password>'],<EOL>)<EOL>valid_connection = check_connection(<EOL>host=pymongo_config['<STR_LIT>'], <EOL>port=pymongo_config['<STR_LIT>'], <EOL>username=pymongo_config['<STR_LIT>'], <EOL>password=pymongo_config['<STR_LIT>'],<EOL>authdb=context.obj['<STR_LIT>'],<EOL>)<EOL>log.info("<STR_LIT>")<EOL>if not valid_connection:<EOL><INDENT>log.warning("<STR_LIT>")<EOL>log.info("<STR_LIT>")<EOL>context.abort()<EOL><DEDENT>config = os.path.abspath(config) if config else None<EOL>app = create_app(config=pymongo_config, config_file=config)<EOL>if livereload:<EOL><INDENT>server = Server(app.wsgi_app)<EOL>server.serve(host=host, port=port, debug=debug)<EOL><DEDENT>else:<EOL><INDENT>app.run(host=host, port=port, debug=debug)<EOL><DEDENT>
Start the web server.