Skip to content

Commit

Permalink
Fix _get_or_create_bucket to actually create bucket
Browse files Browse the repository at this point in the history
  • Loading branch information
linuxlewis committed Jan 12, 2017
1 parent 5f28057 commit 6e85bca
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions storages/backends/s3boto3.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,8 @@ def _get_or_create_bucket(self, name):
"region than we are connecting to. Set "
"the region to connect to by setting "
"AWS_S3_REGION_NAME to the correct region." % name)

elif err.response['ResponseMetadata']['HTTPStatusCode'] == 404:
# Notes: When using the us-east-1 Standard endpoint, you can create
# buckets in other regions. The same is not true when hitting region specific
# endpoints. However, when you create the bucket not in the same region, the
Expand All @@ -364,11 +366,6 @@ def _get_or_create_bucket(self, name):
bucket_params['CreateBucketConfiguration'] = {
'LocationConstraint': region_name}
bucket.create(ACL=self.bucket_acl)
else:
raise ImproperlyConfigured("Bucket %s does not exist. Buckets "
"can be automatically created by "
"setting AWS_AUTO_CREATE_BUCKET to "
"``True``." % name)
return bucket

def _clean_name(self, name):
Expand Down

0 comments on commit 6e85bca

Please sign in to comment.