简体   繁体   English

如何删除Django中minIO存储中的文件?

[英]How to delete file in minIO storage in Django?

I used the minIO storage in my Django app.I want to delete the object from DB and storage.What can I do?我在我的 Django 应用程序中使用了 minIO 存储。我想从数据库和存储中删除 object。我该怎么办? thanks in advance.提前致谢。 this is my model:这是我的 model:

class FileStorage(models.Model):
    team = models.ForeignKey(Team, related_name = 'storage_team', null = True, on_delete = models.CASCADE)
    title = models.CharField(unique=True,max_length=255)
    video = models.FileField(verbose_name="Object Upload",
                            storage=MinioBackend(bucket_name=priv_bucket),
                            upload_to=iso_date_prefix)
                            
    def __str__(self):
        return self.title

You can create a minio client in python and call the remove_object function. Refer here可以在python创建一个minio客户端,调用remove_object function。参考这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM