Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from django.core.files.storage import Storage
- class MinioStorage(Storage):
- server = 'play.minio.io:9000'
- access_key = 'Q3AM3UQ867SPQQA43P2F'
- secret_key = 'zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG'
- bucket = 'mybucket'
- secure = True
- def __init__(self, *args, **kwargs):
- super(MinioStorage, self).__init__(*args, **kwargs)
- self._connection = None
- @property
- def connection(self):
- if self._connection is None:
- try:
- self._connection = Minio(
- self.server, self.access_key, self.secret_key, self.secure)
- except InvalidEndpointError:
- self._connection = None
- return self._connection
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement