def db_session(self): if self._db_session is None: if self.testing: self._db_session = get_session_from_uri(DATABASE_TESTING_CONFIG.URI) else: self._db_session = get_session_from_uri(DATABASE_CONFIG.URI) return self._db_session
def before_request(): g.db = get_session_from_uri(database_config.URI) initialize_base(g.db)