Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BOTO_S3_HOST Setting Ignored #23

Open
ajtaylor6 opened this issue Aug 24, 2015 · 2 comments
Open

BOTO_S3_HOST Setting Ignored #23

ajtaylor6 opened this issue Aug 24, 2015 · 2 comments

Comments

@ajtaylor6
Copy link

I'm writing a Django app that uses DreamObjects for S3 compatible storage. In order to get django-boto to use the correct host, I have tried setting the BOTO_S3_HOST option to 'objects.dreamhost.com' as documented (http://ceph.com/docs/master/radosgw/s3/python/) .

Creating a test key/value using that documentation above specifying objects.dreamhost.com in boto.connect_s3() method allows me to upload and generally do whatever I need to do. However trying to use the same value in BOTO_S3_HOST seems to be ignored in the actual Django app, producing the following trace. I confirmed that boto is trying to reach out to [bucketname].s3.amazonaws.com instead of [bucketname].objects.dreamhost.com via a packet capture from the app server. Running django-storages-redux as the storages communication.

Relevant settings.py configuration:

INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'unflap',
'djrill',
'sorl.thumbnail',
'storages',

)

BOTO_S3_HOST = 'objects.dreamhost.com'

DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
AWS_ACCESS_KEY_ID = omitted
AWS_SECRET_ACCESS_KEY = omitted
AWS_STORAGE_BUCKET_NAME = 'unflap.development'
STATICFILES_STORAGE = 'storages.backends.s3boto.S3BotoStorage'

403 Forbidden traceback triggered because it's trying to hit s3.amazon.aws.com instead of objects.dreamhost.com

Traceback (most recent call last):
File "manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/home/ajtaylor/project-unflap-venv/lib/python3.4/site-packages/django/core/management/init.py", line 338, in execute_from_command_line
utility.execute()
File "/home/ajtaylor/project-unflap-venv/lib/python3.4/site-packages/django/core/management/init.py", line 330, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/ajtaylor/project-unflap-venv/lib/python3.4/site-packages/django/core/management/base.py", line 393, in run_from_argv
self.execute(_args, *_cmd_options)
File "/home/ajtaylor/project-unflap-venv/lib/python3.4/site-packages/django/core/management/base.py", line 444, in execute
output = self.handle(_args, *_options)
File "/home/ajtaylor/project-unflap-venv/lib/python3.4/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 168, in handle
collected = self.collect()
File "/home/ajtaylor/project-unflap-venv/lib/python3.4/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 107, in collect
handler(path, prefixed_path, storage)
File "/home/ajtaylor/project-unflap-venv/lib/python3.4/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 305, in copy_file
if not self.delete_file(path, prefixed_path, source_storage):
File "/home/ajtaylor/project-unflap-venv/lib/python3.4/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 218, in delete_file
if self.storage.exists(prefixed_path):
File "/home/ajtaylor/project-unflap-venv/lib/python3.4/site-packages/storages/backends/s3boto.py", line 432, in exists
return k.exists()
File "/home/ajtaylor/project-unflap-venv/lib/python3.4/site-packages/boto/s3/key.py", line 539, in exists
return bool(self.bucket.lookup(self.name, headers=headers))
File "/home/ajtaylor/project-unflap-venv/lib/python3.4/site-packages/boto/s3/bucket.py", line 142, in lookup
return self.get_key(key_name, headers=headers)
File "/home/ajtaylor/project-unflap-venv/lib/python3.4/site-packages/boto/s3/bucket.py", line 192, in get_key
key, resp = self._get_key_internal(key_name, headers, query_args_l)
File "/home/ajtaylor/project-unflap-venv/lib/python3.4/site-packages/boto/s3/bucket.py", line 230, in _get_key_internal
response.status, response.reason, '')
boto.exception.S3ResponseError: S3ResponseError: 403 Forbidden

@qnub
Copy link
Owner

qnub commented Aug 24, 2015

This package haven't full boto api support and targeted to original Amazon S3 service. I will check your request when i'll have free time for it.

Feel free to send pull request with related changes if you fix it yourself.

@ajtaylor6
Copy link
Author

I can try to take a look, I was just confused since that's a direct option given in the readme file as something that should work. Either that or update the documentation to pull that option until it works. I know I'm likely an edge case.

Per readme:
" BOTO_S3_HOST Amazon S3 hostname. Default to s3.amazonaws.com ."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants