From b90f1da94cf5f5963f9451e57be30f2839a00ef7 Mon Sep 17 00:00:00 2001 From: Kristof Daja Date: Sun, 8 Aug 2021 17:24:20 +0200 Subject: [PATCH 1/3] MANIFEST.in updated --- MANIFEST.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MANIFEST.in b/MANIFEST.in index bbb4b32..7c187d4 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,5 +1,5 @@ include LICENSE -include README.md +include README*.md include RELEASE-VERSION include version.py # recursive-include docs * From a2496364c0aeacf4b754ec1df6d148a28e648b23 Mon Sep 17 00:00:00 2001 From: Kristof Daja Date: Sun, 5 Sep 2021 12:19:57 +0200 Subject: [PATCH 2/3] Added new settings.py parameter: MINIO_HTTP_CLIENT --- README.md | 18 ++++++++++++++++++ django_minio_backend/models.py | 4 +++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9b3e1ed..32d3e1d 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,24 @@ MINIO_POLICY_HOOKS: List[Tuple[str, dict]] = [] # MINIO_MEDIA_FILES_BUCKET = 'my-media-files-bucket' # replacement for MEDIA_ROOT # MINIO_STATIC_FILES_BUCKET = 'my-static-files-bucket' # replacement for STATIC_ROOT MINIO_BUCKET_CHECK_ON_SAVE = True # Default: True // Creates bucket if missing, then save + +# Custom HTTP Client (OPTIONAL) +import os +import certifi +import urllib3 +timeout = timedelta(minutes=5).seconds +ca_certs = os.environ.get('SSL_CERT_FILE') or certifi.where() +MINIO_HTTP_CLIENT: urllib3.poolmanager.PoolManager = urllib3.PoolManager( + timeout=urllib3.util.Timeout(connect=timeout, read=timeout), + maxsize=10, + cert_reqs='CERT_REQUIRED', + ca_certs=ca_certs, + retries=urllib3.Retry( + total=5, + backoff_factor=0.2, + status_forcelist=[500, 502, 503, 504] + ) + ) ``` 4. Implement your own Attachment handler and integrate **django-minio-backend**: diff --git a/django_minio_backend/models.py b/django_minio_backend/models.py index 6ba99b8..05a9cfe 100644 --- a/django_minio_backend/models.py +++ b/django_minio_backend/models.py @@ -115,7 +115,9 @@ def __init__(self, raise ConfigurationError(f'The configured bucket ({self.bucket}) must be declared either in MINIO_PRIVATE_BUCKETS or MINIO_PUBLIC_BUCKETS') # https://docs.min.io/docs/python-client-api-reference.html - self.HTTP_CLIENT: urllib3.poolmanager.PoolManager = self._META_KWARGS.get("http_client", None) + http_client_from_kwargs = self._META_KWARGS.get("http_client", None) + http_client_from_settings = get_setting("MINIO_HTTP_CLIENT") + self.HTTP_CLIENT: urllib3.poolmanager.PoolManager = http_client_from_kwargs or http_client_from_settings bucket_name_intersection: List[str] = list(set(self.PRIVATE_BUCKETS) & set(self.PUBLIC_BUCKETS)) if bucket_name_intersection: From c9f2f9d01f4d6da69e2b908a0c3e7db1ae11df36 Mon Sep 17 00:00:00 2001 From: Kristof Daja Date: Sun, 17 Oct 2021 09:46:10 +0200 Subject: [PATCH 3/3] Released v3.1.0 --- README.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 32d3e1d..e6b7253 100644 --- a/README.md +++ b/README.md @@ -68,16 +68,16 @@ import urllib3 timeout = timedelta(minutes=5).seconds ca_certs = os.environ.get('SSL_CERT_FILE') or certifi.where() MINIO_HTTP_CLIENT: urllib3.poolmanager.PoolManager = urllib3.PoolManager( - timeout=urllib3.util.Timeout(connect=timeout, read=timeout), - maxsize=10, - cert_reqs='CERT_REQUIRED', - ca_certs=ca_certs, - retries=urllib3.Retry( - total=5, - backoff_factor=0.2, - status_forcelist=[500, 502, 503, 504] - ) - ) + timeout=urllib3.util.Timeout(connect=timeout, read=timeout), + maxsize=10, + cert_reqs='CERT_REQUIRED', + ca_certs=ca_certs, + retries=urllib3.Retry( + total=5, + backoff_factor=0.2, + status_forcelist=[500, 502, 503, 504] + ) +) ``` 4. Implement your own Attachment handler and integrate **django-minio-backend**: