'Return a database cursor to the read replica if one is available.'

def _db_cursor(self):

    db_alias = ('read_replica' if ('read_replica' in settings.DATABASES) else 'default')
    return connections[db_alias].cursor()
