scout/server/extensions.py
def init_app(self, app):
        """Initialize from flask"""
        uri = app.config.get("MONGO_URI", None)
        
        db_name = app.config.get("MONGO_DBNAME", 'scout')
        
        try:
            client = get_connection(
                host = app.config.get("MONGO_HOST", 'localhost'),
                port=app.config.get("MONGO_PORT", 27017), 
                username=app.config.get("MONGO_USERNAME", None), 
                password=app.config.get("MONGO_PASSWORD", None),
                uri=uri, 
                mongodb= db_name
            )
        except ConnectionFailure:
            context.abort()

        app.config["MONGO_DATABASE"] = client[db_name]

        app.config['MONGO_CLIENT'] = client
def init_app(self, app):
        uri = app.config.get("MONGO_URI", None)
        
        db_name = app.config.get("MONGO_DBNAME", 'scout')
        
        try:
            client = get_connection(
                host = app.config.get("MONGO_HOST", 'localhost'),
                port=app.config.get("MONGO_PORT", 27017), 
                username=app.config.get("MONGO_USERNAME", None), 
                password=app.config.get("MONGO_PASSWORD", None),
                uri=uri, 
                mongodb= db_name
            )
        except ConnectionFailure:
            context.abort()

        app.config["MONGO_DATABASE"] = client[db_name]

        app.config['MONGO_CLIENT'] = client
def init_app ( self , app ) : uri = app . config . get ( "MONGO_URI" , None ) db_name = app . config . get ( "MONGO_DBNAME" , 'scout' ) try : client = get_connection ( host = app . config . get ( "MONGO_HOST" , 'localhost' ) , port = app . config . get ( "MONGO_PORT" , 27017 ) , username = app . config . get ( "MONGO_USERNAME" , None ) , password = app . config . get ( "MONGO_PASSWORD" , None ) , uri = uri , mongodb = db_name ) except ConnectionFailure : context . abort ( ) app . config [ "MONGO_DATABASE" ] = client [ db_name ] app . config [ 'MONGO_CLIENT' ] = client
Initialize from flask
Initialize from flask