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

Host parameter for AWS S3 Storage Options is not being respected #284

Closed
voiddragon opened this issue May 21, 2018 · 6 comments · Fixed by #333
Closed

Host parameter for AWS S3 Storage Options is not being respected #284

voiddragon opened this issue May 21, 2018 · 6 comments · Fixed by #333

Comments

@voiddragon
Copy link

I've set the host parameter here but the request URL is still being directed to https://bucket-name.s3.amazonaws.com

DBBACKUP_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
DBBACKUP_STORAGE_OPTIONS = {
    'access_key': "",
    'secret_key': "",
    'bucket_name': "bucket-name",
    'host': "s3-eu-west-1.amazonaws.com",
    'location': 'database-backups/'
}
@ZuluPro
Copy link
Contributor

ZuluPro commented May 22, 2018

Hello @voiddragon
As DBBackup uses storage backends, your issue seems directly related to storages.backends.s3boto3.S3Boto3Storage

Isn't it ?

@voiddragon
Copy link
Author

screen shot 2018-05-23 at 10 27 38 am

@ZuluPro The documentation states that the host setting in the storage options can be used to change the default boto3 hostname, do I have to override the boto3 settings instead for this to work?

@ZuluPro
Copy link
Contributor

ZuluPro commented May 23, 2018

@voiddragon The documentation primarly states that the storage is a third package and you should read its doc to understand it.

@voiddragon
Copy link
Author

@ZuluPro Yes I managed to get it to work by modifying the settings for storages, I think the documentation should be updated to reflect that the host setting does not actually work and that it should be updated on the storages settings level to avoid future confusion.

@bartmika
Copy link

I've had this very same issue and fixed it before finding what other people wrote about it on github. I give a +1 for having this issue fixed by the developers.

@bittner
Copy link
Member

bittner commented Jul 2, 2020

I spent quite some time to figure out the solution. The only problem with the documentation, currently, is that the 'host' option doesn't exist anymore with django-storages. Instead, we now need to use the 'endpoint_url', e.g.

DBBACKUP_STORAGE_OPTIONS = {
    'endpoint_url': 'https://s3-compatible-service.example.com',
    'access_key': '*************',
    'secret_key': '*************',
    'bucket_name': 'my-backup',
    'default_acl': 'private',  # WARNING: this option will soon be removed
}

You can look up the available options from get_default_settings() in storages/backends/s3boto3.py.

NOTE: The ''default_acl' option will be removed with the next release of django-storages according to their CHANGELOG.

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

Successfully merging a pull request may close this issue.

4 participants