I can’t add an image through object.create in Django

Good afternoon, I’m trying to insert an image into the database through object.create, but it’s not being inserted in any way, everything else is inserted until the other image.

The image is being created that I have already tested, and is being loaded correctly as jpg.
But I’m not able to use it other than through the path, but I want it to be automatically inserted.

Insertion code I’m using:

stringRegisto = RegistoString.objects.create(string=string_registro,rostosDetectados=frame_io, ecra=estacao_trabalho.owner.photo)

way by path that is working:

stringRegisto = RegistoString.objects.create(string=string_registro, rostosDetectados="/rostos/frame_io.jpg", ecra=estacao_trabalho.owner.photo)

Views.py

    def run_recognition(self, request, frame):
    print("Executando reconhecimento facial...")
    
    rgb_frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)

    # Encontra as localizações das faces no frame
    face_locations = face_recognition.face_locations(rgb_frame)
    # Captura as caracteristicas faciais
    face_encodings = face_recognition.face_encodings(rgb_frame, face_locations)

    face_names = []
    
    last_face_names = request.session.get('last_face_names', [])

    _, frame_encoded = cv2.imencode('.jpg', frame)
    cv2.imwrite('frames/frame_io.jpg', frame)
    frame_io = ContentFile(frame_encoded.tobytes())


    if len(face_encodings) >= 2: # Se houver mais de um rosto no frame
        self.no_face_count = 0
        print("Dois rostos na imagem.")
        face_names = []

        for face_encoding in face_encodings:
            matches = face_recognition.compare_faces(self.known_face_encodings, face_encoding)
            name = "Unknown"
            if True in matches:
                first_match_index = matches.index(True)
                name = self.known_face_names[first_match_index]
            face_names.append(name)
            estacao_trabalho = EstacaoTrabalho.objects.get(uuid=self.uuid)

        # Ordena os nomes por ordem alfabética
        face_names.sort()
        
        print("Rostos reconhecidos:", ", ".join(face_names))

        estacao_owner_name = estacao_trabalho.owner.name
        
        # Verifica se houve mudança nos rostos reconhecidos

        if last_face_names == face_names:
            print("Rostos reconhecidos permanecem os mesmos, não criando registro.")
        else:
            # Verifica se o owner da EstacaoTrabalho tem um nome diferente dos rostos reconhecidos
            if estacao_trabalho.owner:  # Verifica se a estação de trabalho tem um proprietário
                # Se tiver um proprietário, atribui o nome do proprietário à variável estacao_owner_name
                print("Owner da estação de trabalho:", estacao_trabalho.owner.name)
                estacao_owner_name = estacao_trabalho.owner.name
            else:
                print("Estação de trabalho sem proprietário.")
                # Se não tiver um proprietário, atribui uma string vazia à variável estacao_owner_name
                estacao_owner_name = ""
                

            string_registro = f"{', '.join(face_names)} estão a visualizar a tela de {estacao_owner_name} na estacao {estacao_trabalho.name}"

            if not frame_io:
                raise ValueError("Nenhuma imagem fornecida")

            stringRegisto = RegistoString.objects.create(string=string_registro, rostosDetectados="/rostos/frame_io.jpg", ecra=estacao_trabalho.owner.photo)
            stringRegisto.save()

            print("Registro de string criado:", string_registro)
            request.session['last_face_names'] = face_names

Models

=======

class RegistoString(models.Model): #Tabela RegistosString
string = models.CharField(max_length=100, null=True)
rostosDetectados = models.ImageField(upload_to='rostos/',null=True)
ecra = models.ImageField(upload_to='ecra/',null=True)

def __str__(self):
    return self.string

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật