django-storages - 配置不当:无法加载亚马逊的 s3 绑定
django-storages - ImproperlyConfigured: Could not load amazon's s3 bindings
我现在觉得很傻
我正在尝试使用 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.
我错过了什么
根据 documentation:
There are two backend APIs for interacting with S3. The first is the
s3 backend (in storages/backends/s3.py) which is simple and based on
the Amazon S3 Python library.
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。
我可能会混淆原始库和分叉库,但我认为这一点仍然有效。
我现在觉得很傻
我正在尝试使用 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.
我错过了什么
根据 documentation:
There are two backend APIs for interacting with S3. The first is the s3 backend (in storages/backends/s3.py) which is simple and based on the Amazon S3 Python library.
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。
我可能会混淆原始库和分叉库,但我认为这一点仍然有效。