Django Storages - Could Not Load Amazon's S3 Bindings Errors

agassi0430 picture agassi0430 · Nov 14, 2012 · Viewed 8.5k times · Source

Hey so trying to connect my user uploaded images to my S3 bucket so the images will store there. Using django storages (did some research, seemed to be what everyone suggested, but open to ideas)

Here's what I did:

Installed django storages

pip install django-storages

Added it to my INSTALLED_APPS

#settings.py
INSTALLED_APPS = (
...
'storages',
)

And added this code as well to settings.py

#settings.py
DEFAULT_FILE_STORAGE = 'storages.backends.s3.S3Storage'
AWS_ACCESS_KEY_ID = '#################'
AWS_SECRET_ACCESS_KEY = '#######################'
AWS_STORAGE_BUCKET_NAME = 'mybucketname'

Then I open the shell and run this to check

from django.core.files.storage import default_storage
print default_storage.connection
...
ImproperlyConfigured: Could not load amazon's S3 bindings.
See http://developer.amazonwebservices.com/connect/entry.jspa?externalID=134

The link leads to a 404 error. Have been following along with the documentation and tried all 3 ways to set up DEFAULT_FILE_STORAGE, and none of them work. See below.

DEFAULT_FILE_STORAGE = 'libs.storages.backends.S3Storage.S3Storage'
ImproperlyConfigured: Error importing storage module libs.storages.backends.S3Storage

DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
ImproperlyConfigured: Could not load Boto's S3 bindings.

How can I set this up correctly?

Answer

Daniel Barden picture Daniel Barden · Nov 14, 2012

Do you have python-boto installed?
pip install boto or pip install boto3