简体   繁体   中英

Getting [Errno 32] Broken pipe when using django-storages and s3

I am having trouble using django-storages with s3. Everything works using boto (creating and reading back files) so it's not anything to do with credentials.

I have the following keys in settings.py:

DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
AWS_ACCESS_KEY_ID = '...'
AWS_SECRET_ACCESS_KEY = '...'
AWS_STORAGE_BUCKET_NAME = 'sff-dev'

I have the following model:

class Document(models.Model):
    title = models.CharField(max_length=100)
    document = models.FileField(upload_to='documents')

I'm not sure what I should be using for upload_to, if anything. I've also tried '/'.

I have tried various things such as setting AWS_QUERYSTRING_AUTH = False and AWS_S3_SECURE_URLS = False but nothing works.

I've been researching this as well. found my solution in these answers

tl;dr: is that I switched from django-storages to django-storages-redux and added the below to my settings.py :

AWS_S3_HOST = "s3-us-west-2.amazonaws.com"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM