Add CUSTOM_HOST to s3 connection

Issue #123 new
created an issue

When using S3 from other datacenter like sa-east-1 the host to do the connection need to be changed. Currently there is no way to set it.

I'm attaching a simple patch to add a CUSTOM_HOST setting.

Comments (4)

  1. Kamal Mustafa

    I have been hit by this issue too today. Been using django-storages since last year and never had any issue until today. Related issue on boto repo:-

    There are 2 pull requests on this:-

    As a workaround you can define your own STATICFILES_STORAGE class and override the connection method like below:-

    from storages.backends.s3boto import S3Connection, setting
    from storages.backends.s3boto import S3BotoStorage as S3BotoStorageOrig
    class S3BotoStorage(S3BotoStorageOrig):
        custom_host = setting('AWS_S3_CUSTOM_HOST', S3Connection.DefaultHost)
        def connection(self):
            if self._connection is None:
                self._connection = self.connection_class(
                    self.access_key, self.secret_key,
            return self._connection

    Then change your to use this class instead:-


  2. Log in to comment