Tôi đã theo dõi this tutorial để thiết lập Amazon S3 với Django. Nhưng khi tôi đang sử dụng Python 3.3, tôi đã cài đặt Python-3 compatible fork của django-storages và boto3 thay thế.Django với Amazon S3 qua boto3: Không đúng cấu hình
Đây là tập tin settings.py:
AWS_STORAGE_BUCKET_NAME = os.environ['LIVIN_AWS_STORAGE_BUCKET_NAME']
S3_REGION_NAME = os.environ['LIVIN_S3_REGION_NAME']
AWS_ACCESS_KEY_ID = os.environ['LIVIN_AWS_ACCESS_KEY_ID']
AWS_SECRET_ACCESS_KEY = os.environ['LIVIN_AWS_SECRET_ACCESS_KEY']
AWS_S3_CUSTOM_DOMAIN = '%s.s3.amazonaws.com' % AWS_STORAGE_BUCKET_NAME
STATIC_URL = "https://%s/" % AWS_S3_CUSTOM_DOMAIN
# Tell the staticfiles app to use S3Boto storage when writing the collected
# static files (when you run `collectstatic`).
STATICFILES_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
Khi tôi cố gắng, python manage.py collectstatic
tôi nhận được lỗi này:
ImportError: No module named 'boto'
During handling of the above exception, another exception occurred:
...
django.core.exceptions.ImproperlyConfigured: Could not load Boto's S3 bindings.
See https://github.com/boto/boto
Có vẻ như phụ trợ lưu trữ là boto một, không phải là một boto3.
Như đã đề cập ở đây https://github.com/jschneier/django-storages#history Dường như django-kho-Redux hiện đang phát hành dưới django-kho, vì vậy 'pips cài đặt django-storages' 'pip install boto' làm việc cho tôi – kraenhansen
Chỉ cần lưu ý ...' boto3' thực sự là [100% Python] (https://github.com/boto/boto3) và là [giờ tương thích] (https://github.com/jschneier/django-storages/issues/57) với 'django-storages'. – alxs