Permalink
Browse files

better bucket creation

  • Loading branch information...
1 parent 986765f commit 8331075b34072c1159bd8808b50babe7042973fe Koen Bok committed Sep 11, 2012
Showing with 14 additions and 8 deletions.
  1. +14 −8 cactus/site.py
View
@@ -254,21 +254,27 @@ def upload(self):
# Configure S3 to use the index.html and error.html files for indexes and 404/500s.
awsBucket.configure_website('index.html', 'error.html')
-
+
+ self.config.set('aws-bucket-website', awsBucket.get_website_endpoint())
+ self.config.set('aws-bucket-name', awsBucketName)
+ self.config.write()
+
+ logging.info('Bucket %s was selected with website endpoint %s' % (self.config.get('aws-bucket-name'), self.config.get('aws-bucket-website')))
+ logging.info('You can learn more about s3 (like pointing to your own domain) here: https://github.com/koenbok/Cactus')
+
+
else: return
else:
# Grab a reference to the existing bucket
for b in buckets:
if b.name == awsBucketName:
awsBucket = b
-
- self.config.set('aws-bucket-website', awsBucket.get_website_endpoint())
- self.config.set('aws-bucket-name', awsBucketName)
- self.config.write()
-
- logging.info('Bucket %s was selected with website endpoint %s' % (self.config.get('aws-bucket-name'), self.config.get('aws-bucket-website')))
- logging.info('You can learn more about s3 (like pointing to your own domain) here: https://github.com/koenbok/Cactus')
+
+ # Make sure we have the endpoint in the config
+ if not self.config.get('aws-bucket-website'):
+ self.config.set('aws-bucket-website', awsBucket.get_website_endpoint())
+ self.config.write()
logging.info('Uploading site to bucket %s' % awsBucketName)

0 comments on commit 8331075

Please sign in to comment.