【问题标题】:Set file permission not public with django-storages and S3boto使用 django-storages 和 S3boto 设置文件权限不公开
【发布时间】:2014-05-15 01:28:01
【问题描述】:

我正在使用 django-storages 和 botoS3 开发 django1.4 应用程序。

我有这样的模型

class MyModel(models.Model):
    image = models.ImageField(blank=True, null=True, upload_to='my_image')

我不想公开图像,但是 django-storage 将文件权限设置为公开 (受赠人:每个人都打开/下载)自动。

你能告诉我如何设置权限不自动公开吗? 谢谢!

【问题讨论】:

  • django-storages 应该根据bucket为key设置ACL

标签: python django amazon-s3 boto


【解决方案1】:

您可以使用AWS_DEFAULT_ACL 设置,如果您将其设置为'private',s3boto 会将文件存储为私有。

我认为这没有记录,但您可以在source code of the original __init__ function 中看到 django-storage S3 参数的完整列表。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-06-05
    • 2013-01-27
    • 2017-10-05
    • 2016-02-06
    • 1970-01-01
    • 1970-01-01
    • 2013-10-05
    • 1970-01-01
    相关资源
    最近更新 更多