【问题标题】:django-storages - ImproperlyConfigured: Could not load amazon's s3 bindingsdjango-storages - 配置不当:无法加载亚马逊的 s3 绑定
【发布时间】:2016-02-12 16:27:07
【问题描述】:

我现在感觉很傻

我正在尝试使用django-storages

我安装了

pip install django-storages

然后,将'storages', 添加到 settings.py 中

然后在settings.py中

DEFAULT_FILE_STORAGE = 'storages.backends.s3.S3Storage'
AWS_ACCESS_KEY_ID = 'xxx'
AWS_SECRET_ACCESS_KEY = 'yyy'
AWS_STORAGE_BUCKET_NAME = 'mybucketname'

并尝试查看是否更改了默认文件存储:

>>> from django.core.files.storage import default_storage
>>> print default_storage.connection
....
ImproperlyConfigured: Could not load amazon's s3 bindings.

我错过了什么

【问题讨论】:

  • 您是否安装了boto?安装它有什么不同吗?谢谢。
  • pip install boto ^^ 只是为了捎带
  • @jape 我做到了,没有任何成功的迹象

标签: python django amazon-s3 django-storage


【解决方案1】:

根据documentation

有两个用于与 S3 交互的后端 API。第一个是 s3 后端(在 storages/backends/s3.py 中),很简单,基于 Amazon S3 Python 库

还有source code

try:
    from S3 import AWSAuthConnection, QueryStringAuthGenerator, CallingFormat
except ImportError:
    raise ImproperlyConfigured("Could not load amazon's S3 bindings.\nSee "
        "http://developer.amazonwebservices.com/connect/entry.jspa?externalID=134")

storages.backends.s3.S3Storage 后端需要安装Amazon S3 library

我可能会混淆原始库和 fork,但我认为这一点仍然有效。

【讨论】:

  • 谢谢亚历克斯,我从链接下载了文件,现在它可以工作了
  • 现在我收到了The bucket you are attempting to access must be addressed using the specified endpoint,因为我的存储桶在法兰克福,但这是一个不同的问题..(或任何想法?:))?
  • @doniyor 是的,可能是这个问题:stackoverflow.com/questions/25027462/…
猜你喜欢
  • 1970-01-01
  • 2018-01-22
  • 2014-06-04
  • 1970-01-01
  • 1970-01-01
  • 2020-05-31
  • 1970-01-01
  • 2010-10-20
  • 2012-05-01
相关资源
最近更新 更多