def init_app(self, app, datastore=None, register_blueprint=None, **kwargs):
        """Initializes the Flask-Security extension for the specified
        application and datastore implementation.

        :param app: The application.
        :param datastore: An instance of a user datastore.
        :param register_blueprint: to register the Security blueprint or not.
        """
        self.app = app

        if datastore is None:
            datastore = self._datastore

        if register_blueprint is None:
            register_blueprint = self._register_blueprint

        for key, value in self._kwargs.items():
            kwargs.setdefault(key, value)

        for key, value in _default_config.items():
            app.config.setdefault('SECURITY_' + key, value)

        for key, value in _default_messages.items():
            app.config.setdefault('SECURITY_MSG_' + key, value)

        identity_loaded.connect_via(app)(_on_identity_loaded)

        self._state = state = _get_state(app, datastore, **kwargs)

        if register_blueprint:
            app.register_blueprint(create_blueprint(state, __name__))
            app.context_processor(_context_processor)

        @app.before_first_request
        def _register_i18n():
            if '_' not in app.jinja_env.globals:
                app.jinja_env.globals['_'] = state.i18n_domain.gettext

        state.render_template = self.render_template
        state.send_mail = self.send_mail
        app.extensions['security'] = state

        if hasattr(app, 'cli'):
            from .cli import users, roles
            if state.cli_users_name:
                app.cli.add_command(users, state.cli_users_name)
            if state.cli_roles_name:
                app.cli.add_command(roles, state.cli_roles_name)

        return state
def init_app ( self , app , datastore = None , register_blueprint = None , ** kwargs ) : self . app = app if datastore is None : datastore = self . _datastore if register_blueprint is None : register_blueprint = self . _register_blueprint for key , value in self . _kwargs . items ( ) : kwargs . setdefault ( key , value ) for key , value in _default_config . items ( ) : app . config . setdefault ( 'SECURITY_' + key , value ) for key , value in _default_messages . items ( ) : app . config . setdefault ( 'SECURITY_MSG_' + key , value ) identity_loaded . connect_via ( app ) ( _on_identity_loaded ) self . _state = state = _get_state ( app , datastore , ** kwargs ) if register_blueprint : app . register_blueprint ( create_blueprint ( state , __name__ ) ) app . context_processor ( _context_processor ) @ app . before_first_request def _register_i18n ( ) : if '_' not in app . jinja_env . globals : app . jinja_env . globals [ '_' ] = state . i18n_domain . gettext state . render_template = self . render_template state . send_mail = self . send_mail app . extensions [ 'security' ] = state if hasattr ( app , 'cli' ) : from . cli import users , roles if state . cli_users_name : app . cli . add_command ( users , state . cli_users_name ) if state . cli_roles_name : app . cli . add_command ( roles , state . cli_roles_name ) return state
Initializes the Flask-Security extension for the specified
        application and datastore implementation.

        :param app: The application.
        :param datastore: An instance of a user datastore.
        :param register_blueprint: to register the Security blueprint or not.