code: def get_app(
          database_uri,
          exclude_tables=None,
          user_models=None,
          reflect_all=True,
          read_only=False,
          schema=None):
      
      app = Flask('sandman2')
      app.config['SQLALCHEMY_DATABASE_URI'] = database_uri
      app.config['SANDMAN2_READ_ONLY'] = read_only
      app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
      app.classes = []
      db.init_app(app)
      admin = Admin(app, base_template='layout.html', template_mode='bootstrap3')
      _register_error_handlers(app)
      if user_models:
          with app.app_context():
              _register_user_models(user_models, admin, schema=schema)
      elif reflect_all:
          with app.app_context():
              _reflect_all(exclude_tables, admin, read_only, schema=schema)
  
      @app.route('/')
      def index():
          """Return a list of routes to the registered classes."""
          routes = {}
          for cls in app.classes:
              routes[cls.__model__.__name__] = '{}{{/{}}}'.format(
                  cls.__model__.__url__,
                  cls.__model__.primary_key())
          return jsonify(routes)
      return app
docs: Return an application instance connected to the database described in
      *database_uri*.
  
      :param str database_uri: The URI connection string for the database
      :param list exclude_tables: A list of tables to exclude from the API
                                  service
      :param list user_models: A list of user-defined models to include in the
                               API service
      :param bool reflect_all: Include all database tables in the API service
      :param bool read_only: Only allow HTTP GET commands for all endpoints
      :param str schema: Use the specified named schema instead of the default