Failed to load Boto S3 bindings. (Installed by Boto)

I am trying to use s3 to store user downloadable files, I am using django repositories

pip install django repositories

Added it to my INSTALLED_APPS

INSTALLED_APPS = (

...

'' storage

)

set variables in settings.py

DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage'

AWS_ACCESS_KEY_ID = '##################'

AWS_SECRET_ACCESS_KEY = '##########################

AWS_STORAGE_BUCKET_NAME = 'mybucketname'

I installed boto

sudo pip install boto

dyld: DYLD_ environment variables are ignored because the main executable (/ usr / bin / sudo) is setuid or setgid

The requirement has already been met (use --upgrade to upgrade): boto in / Library / Python / 2.7 / site-packages / boto-2.9.0_dev-py2.7.egg

Cleaning ...

When I save the item, the django debug page is displayed,

Failed to load Boto S3 bindings.

See https://github.com/boto/boto

Any ideas? (I am using mac os x 10.8.3)

+4
source share
1 answer

create bash script: install_latest_boto.sh:

#install latest boto from source cd /home/ubuntu/ sudo mkdir boto_temp cd boto_temp sudo git clone git://github.com/boto/boto.git cd boto sudo python setup.py install 

in Django settings - the default django repository will be s3:

 DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage' STATICFILES_STORAGE = 'storages.backends.s3boto.S3BotoStorage' AWS_S3_FILE_OVERWRITE = False 

on your models.py:

 class MyBaseModel(models.Model): class Meta: abstract = True @staticmethod def get_upload_path(instance, filename): if hasattr(instance, 'get_upload_folder'): return os.path.join(instance.get_upload_folder(), filename) else: raise Exception('Upload Folder is missing') class User(MyBaseModel): name = models.CharField(max_length=100) email = models.EmailField(max_length=255, unique=True) image = models.ImageField(upload_to=MyBaseModel.get_upload_path, default=None, blank=True, max_length=200) def get_upload_folder(self): upload_folder = 'users/images/orig' return upload_folder 
0
source

All Articles