django-minio-backend-five


Namedjango-minio-backend-five JSON
Version 3.5.3 PyPI version JSON
download
home_pagehttps://github.com/theriverman/django-minio-backend
SummaryA Fork of The django-minio-backend by Kristof Daja (theriverman), provides a wrapper around the MinIO Python Library. Now with Django 5 Support
upload_time2024-03-06 08:53:24
maintainer
docs_urlNone
authorKristof Daja (theriverman)
requires_python>=3.10
licenseMIT License Copyright (c) 2019 Kristof Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords django minio backend django-minio django-minio-backend minio-backend
VCS
bugtrack_url
requirements Django minio Pillow setuptools
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # django-minio-backend-five

[![django-app-tests](https://github.com/theriverman/django-minio-backend/actions/workflows/django-tests.yml/badge.svg)](https://github.com/theriverman/django-minio-backend/actions/workflows/django-tests.yml)
[![publish-py-dist-to-pypi](https://github.com/theriverman/django-minio-backend/actions/workflows/publish-to-pypi.yml/badge.svg)](https://github.com/theriverman/django-minio-backend/actions/workflows/publish-to-pypi.yml)
[![PYPI](https://img.shields.io/pypi/v/django-minio-backend.svg)](https://pypi.python.org/pypi/django-minio-backend-five)

A Fork of The **django-minio-backend** by **Kristof Daja (theriverman)**, provides a wrapper around the MinIO Python Library. Now with Django 5 Support

The **django-minio-backend-five** provides a wrapper around the
[MinIO Python SDK](https://docs.min.io/docs/python-client-quickstart-guide.html).
See [minio/minio-py](https://github.com/minio/minio-py) for the source.

## Integration

1. Get and install the package:

    ```bash
    pip install django-minio-backend
    ```

2. Add `django_minio_backend` to `INSTALLED_APPS`:

    ```python
    INSTALLED_APPS = [
        # '...'
        'django_minio_backend',  # https://github.com/theriverman/django-minio-backend
    ]
    ```

    If you would like to enable on-start consistency check, install via `DjangoMinioBackendConfig`:

    ```python
    INSTALLED_APPS = [
        # '...'
        'django_minio_backend.apps.DjangoMinioBackendConfig',  # https://github.com/theriverman/django-minio-backend
    ]
    ```

    Then add the following parameter to your settings file:

    ```python
    MINIO_CONSISTENCY_CHECK_ON_START = True
    ```

    **Note:** The on-start consistency check equals to manually calling `python manage.py initialize_buckets`.\
    It is recommended to turn *off* this feature during development by setting `MINIO_CONSISTENCY_CHECK_ON_START` to `False`,
    because this operation can noticeably slow down Django's boot time when many buckets are configured.

3. Add the following parameters to your `settings.py`:

    ```python
    from datetime import timedelta
    from typing import List, Tuple

    MINIO_ENDPOINT = 'minio.your-company.co.uk'
    MINIO_EXTERNAL_ENDPOINT = "external-minio.your-company.co.uk"  # Default is same as MINIO_ENDPOINT
    MINIO_EXTERNAL_ENDPOINT_USE_HTTPS = True  # Default is same as MINIO_USE_HTTPS
    MINIO_REGION = 'us-east-1'  # Default is set to None
    MINIO_ACCESS_KEY = 'yourMinioAccessKey'
    MINIO_SECRET_KEY = 'yourVeryS3cr3tP4ssw0rd'
    MINIO_USE_HTTPS = True
    MINIO_URL_EXPIRY_HOURS = timedelta(days=1)  # Default is 7 days (longest) if not defined
    MINIO_CONSISTENCY_CHECK_ON_START = True
    MINIO_PRIVATE_BUCKETS = [
        'django-backend-dev-private',
    ]
    MINIO_PUBLIC_BUCKETS = [
        'django-backend-dev-public',
    ]
    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**:

    ```python
    from django.db import models
    from django_minio_backend import MinioBackend, iso_date_prefix

    class PrivateAttachment(models.Model):   
        file = models.FileField(verbose_name="Object Upload",
                                storage=MinioBackend(bucket_name='django-backend-dev-private'),
                                upload_to=iso_date_prefix)
    ```

5. Initialize the buckets & set their public policy (OPTIONAL):\
   This `django-admin` command creates both the private and public buckets in case one of them does not exists,
   and sets the *public* bucket's privacy policy from `private`(default) to `public`.\

   ```bash
   python manage.py initialize_buckets
   ```

   Code reference: [initialize_buckets.py](django_minio_backend/management/commands/initialize_buckets.py).

### Static Files Support

**django-minio-backend** allows serving static files from MinIO.
To learn more about Django static files, see [Managing static files](https://docs.djangoproject.com/en/3.2/howto/static-files/), and [STATICFILES_STORAGE](https://docs.djangoproject.com/en/3.2/ref/settings/#staticfiles-storage).

To enable static files support, update your `settings.py`:

```python
STATICFILES_STORAGE = 'django_minio_backend.models.MinioBackendStatic'
MINIO_STATIC_FILES_BUCKET = 'my-static-files-bucket'  # replacement for STATIC_ROOT
# Add the value of MINIO_STATIC_FILES_BUCKET to one of the pre-configured bucket lists. eg.:
# MINIO_PRIVATE_BUCKETS.append(MINIO_STATIC_FILES_BUCKET)
# MINIO_PUBLIC_BUCKETS.append(MINIO_STATIC_FILES_BUCKET)
```

The value of `STATIC_URL` is ignored, but it must be defined otherwise Django will throw an error.

**IMPORTANT**\
The value set in `MINIO_STATIC_FILES_BUCKET` must be added either to `MINIO_PRIVATE_BUCKETS` or `MINIO_PUBLIC_BUCKETS`,
otherwise **django-minio-backend** will raise an exception. This setting determines the privacy of generated file URLs which can be unsigned public or signed private.  

**Note:** If `MINIO_STATIC_FILES_BUCKET` is not set, the default value (`auto-generated-bucket-static-files`) will be used. Policy setting for default buckets is **private**.

### Default File Storage Support

**django-minio-backend** can be configured as a default file storage.
To learn more, see [DEFAULT_FILE_STORAGE](https://docs.djangoproject.com/en/3.2/ref/settings/#default-file-storage).

To configure **django-minio-backend** as the default file storage, update your `settings.py`:

```python
DEFAULT_FILE_STORAGE = 'django_minio_backend.models.MinioBackend'
MINIO_MEDIA_FILES_BUCKET = 'my-media-files-bucket'  # replacement for MEDIA_ROOT
# Add the value of MINIO_STATIC_FILES_BUCKET to one of the pre-configured bucket lists. eg.:
# MINIO_PRIVATE_BUCKETS.append(MINIO_STATIC_FILES_BUCKET)
# MINIO_PUBLIC_BUCKETS.append(MINIO_STATIC_FILES_BUCKET)
```

The value of `MEDIA_URL` is ignored, but it must be defined otherwise Django will throw an error.

**IMPORTANT**\
The value set in `MINIO_MEDIA_FILES_BUCKET` must be added either to `MINIO_PRIVATE_BUCKETS` or `MINIO_PUBLIC_BUCKETS`,
otherwise **django-minio-backend** will raise an exception. This setting determines the privacy of generated file URLs which can be unsigned public or signed private.

**Note:** If `MINIO_MEDIA_FILES_BUCKET` is not set, the default value (`auto-generated-bucket-media-files`) will be used. Policy setting for default buckets is **private**.

### Health Check

To check the connection link between Django and MinIO, use the provided `MinioBackend.is_minio_available()` method.\
It returns a `MinioServerStatus` instance which can be quickly evaluated as boolean.\

**Example:**

```python
from django_minio_backend import MinioBackend

minio_available = MinioBackend().is_minio_available()  # An empty string is fine this time
if minio_available:
    print("OK")
else:
    print("NOK")
    print(minio_available.details)
```

### Policy Hooks

You can configure **django-minio-backend** to automatically execute a set of pre-defined policy hooks.\
Policy hooks can be defined in `settings.py` by adding `MINIO_POLICY_HOOKS` which must be a list of tuples.\
Policy hooks are automatically picked up by the `initialize_buckets` management command.

For an exemplary policy, see the implementation of `def set_bucket_to_public(self)`
in [django_minio_backend/models.py](django_minio_backend/models.py) or the contents
of [examples/policy_hook.example.py](examples/policy_hook.example.py).

### Consistency Check On Start

When enabled, the `initialize_buckets` management command gets called automatically when Django starts.\
This command connects to the configured minIO server and checks if all buckets defined in `settings.py`.\
In case a bucket is missing or its configuration differs, it gets created and corrected.

### Reference Implementation

For a reference implementation, see [Examples](examples).

## Behaviour

The following list summarises the key characteristics of **django-minio-backend**:

* Bucket existence is **not** checked on a save by default.
 To enable this guard, set `MINIO_BUCKET_CHECK_ON_SAVE = True` in your `settings.py`.
* Bucket existences are **not** checked on Django start by default.
 To enable this guard, set `MINIO_CONSISTENCY_CHECK_ON_START = True` in your `settings.py`.
* Many configuration errors are validated through `AppConfig` but not every error can be captured there.
* Files with the same name in the same bucket are **not** replaced on save by default. Django will store the newer file with an altered file name
 To allow replacing existing files, pass the `replace_existing=True` kwarg to `MinioBackend`.
 For example: `image = models.ImageField(storage=MinioBackend(bucket_name='images-public', replace_existing=True))`
* Depending on your configuration, **django-minio-backend** may communicate over two kind of interfaces: internal and external.
 If your `settings.py` defines a different value for `MINIO_ENDPOINT` and `MINIO_EXTERNAL_ENDPOINT`, then the former will be used for internal communication
 between Django and MinIO, and the latter for generating URLs for users. This behaviour optimises the network communication.
 See **Networking** below for a thorough explanation
* The uploaded object's content-type is guessed during save. If `mimetypes.guess_type` fails to determine the correct content-type, then it falls back to `application/octet-stream`.

## Networking and Docker

If your Django application is running on a shared host with your MinIO instance, you should consider using the `MINIO_EXTERNAL_ENDPOINT` and `MINIO_EXTERNAL_ENDPOINT_USE_HTTPS` parameters.
This way most traffic will happen internally between Django and MinIO. The external endpoint parameters are required for external pre-signed URL generation.

If your Django application and MinIO instance are running on different hosts, you can omit the `MINIO_EXTERNAL_ENDPOINT` and `MINIO_EXTERNAL_ENDPOINT_USE_HTTPS` parameters, and **django-minio-backend** will default to the value of `MINIO_ENDPOINT`.

Setting up and configuring custom networks in Docker is not in the scope of this document.\
To learn more about Docker networking, see [Networking overview](https://docs.docker.com/network/) and [Networking in Compose](https://docs.docker.com/compose/networking/).

See [README.Docker.md](README.Docker.md) for a real-life Docker Compose demonstration.

## Compatibility

* Django 4.2 or later
* Python 3.10 or later
* MinIO SDK 7.0.2 or later

## Contribution

Please find the details in [CONTRIBUTE.md](CONTRIBUTE.md)

## Copyright

* theriverman/django-minio-backend licensed under the MIT License
* minio/minio-py is licensed under the Apache License 2.0

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/theriverman/django-minio-backend",
    "name": "django-minio-backend-five",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": "",
    "keywords": "django,minio,backend,django-minio,django-minio-backend,minio-backend",
    "author": "Kristof Daja (theriverman)",
    "author_email": "Habibul Rahman Qalbi <habi6799@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/f4/e4/73dfceb36b5cfec1e50619a318b5b9aeb8d91baebc5b0123bab97447ed89/django-minio-backend-five-3.5.3.tar.gz",
    "platform": null,
    "description": "# django-minio-backend-five\r\n\r\n[![django-app-tests](https://github.com/theriverman/django-minio-backend/actions/workflows/django-tests.yml/badge.svg)](https://github.com/theriverman/django-minio-backend/actions/workflows/django-tests.yml)\r\n[![publish-py-dist-to-pypi](https://github.com/theriverman/django-minio-backend/actions/workflows/publish-to-pypi.yml/badge.svg)](https://github.com/theriverman/django-minio-backend/actions/workflows/publish-to-pypi.yml)\r\n[![PYPI](https://img.shields.io/pypi/v/django-minio-backend.svg)](https://pypi.python.org/pypi/django-minio-backend-five)\r\n\r\nA Fork of The **django-minio-backend** by **Kristof Daja (theriverman)**, provides a wrapper around the MinIO Python Library. Now with Django 5 Support\r\n\r\nThe **django-minio-backend-five** provides a wrapper around the\r\n[MinIO Python SDK](https://docs.min.io/docs/python-client-quickstart-guide.html).\r\nSee [minio/minio-py](https://github.com/minio/minio-py) for the source.\r\n\r\n## Integration\r\n\r\n1. Get and install the package:\r\n\r\n    ```bash\r\n    pip install django-minio-backend\r\n    ```\r\n\r\n2. Add `django_minio_backend` to `INSTALLED_APPS`:\r\n\r\n    ```python\r\n    INSTALLED_APPS = [\r\n        # '...'\r\n        'django_minio_backend',  # https://github.com/theriverman/django-minio-backend\r\n    ]\r\n    ```\r\n\r\n    If you would like to enable on-start consistency check, install via `DjangoMinioBackendConfig`:\r\n\r\n    ```python\r\n    INSTALLED_APPS = [\r\n        # '...'\r\n        'django_minio_backend.apps.DjangoMinioBackendConfig',  # https://github.com/theriverman/django-minio-backend\r\n    ]\r\n    ```\r\n\r\n    Then add the following parameter to your settings file:\r\n\r\n    ```python\r\n    MINIO_CONSISTENCY_CHECK_ON_START = True\r\n    ```\r\n\r\n    **Note:** The on-start consistency check equals to manually calling `python manage.py initialize_buckets`.\\\r\n    It is recommended to turn *off* this feature during development by setting `MINIO_CONSISTENCY_CHECK_ON_START` to `False`,\r\n    because this operation can noticeably slow down Django's boot time when many buckets are configured.\r\n\r\n3. Add the following parameters to your `settings.py`:\r\n\r\n    ```python\r\n    from datetime import timedelta\r\n    from typing import List, Tuple\r\n\r\n    MINIO_ENDPOINT = 'minio.your-company.co.uk'\r\n    MINIO_EXTERNAL_ENDPOINT = \"external-minio.your-company.co.uk\"  # Default is same as MINIO_ENDPOINT\r\n    MINIO_EXTERNAL_ENDPOINT_USE_HTTPS = True  # Default is same as MINIO_USE_HTTPS\r\n    MINIO_REGION = 'us-east-1'  # Default is set to None\r\n    MINIO_ACCESS_KEY = 'yourMinioAccessKey'\r\n    MINIO_SECRET_KEY = 'yourVeryS3cr3tP4ssw0rd'\r\n    MINIO_USE_HTTPS = True\r\n    MINIO_URL_EXPIRY_HOURS = timedelta(days=1)  # Default is 7 days (longest) if not defined\r\n    MINIO_CONSISTENCY_CHECK_ON_START = True\r\n    MINIO_PRIVATE_BUCKETS = [\r\n        'django-backend-dev-private',\r\n    ]\r\n    MINIO_PUBLIC_BUCKETS = [\r\n        'django-backend-dev-public',\r\n    ]\r\n    MINIO_POLICY_HOOKS: List[Tuple[str, dict]] = []\r\n    # MINIO_MEDIA_FILES_BUCKET = 'my-media-files-bucket'  # replacement for MEDIA_ROOT\r\n    # MINIO_STATIC_FILES_BUCKET = 'my-static-files-bucket'  # replacement for STATIC_ROOT\r\n    MINIO_BUCKET_CHECK_ON_SAVE = True  # Default: True // Creates bucket if missing, then save\r\n\r\n    # Custom HTTP Client (OPTIONAL)\r\n    import os\r\n    import certifi\r\n    import urllib3\r\n    timeout = timedelta(minutes=5).seconds\r\n    ca_certs = os.environ.get('SSL_CERT_FILE') or certifi.where()\r\n    MINIO_HTTP_CLIENT: urllib3.poolmanager.PoolManager = urllib3.PoolManager(\r\n        timeout=urllib3.util.Timeout(connect=timeout, read=timeout),\r\n        maxsize=10,\r\n        cert_reqs='CERT_REQUIRED',\r\n        ca_certs=ca_certs,\r\n        retries=urllib3.Retry(\r\n            total=5,\r\n            backoff_factor=0.2,\r\n            status_forcelist=[500, 502, 503, 504]\r\n        )\r\n    )\r\n    ```\r\n\r\n4. Implement your own Attachment handler and integrate **django-minio-backend**:\r\n\r\n    ```python\r\n    from django.db import models\r\n    from django_minio_backend import MinioBackend, iso_date_prefix\r\n\r\n    class PrivateAttachment(models.Model):   \r\n        file = models.FileField(verbose_name=\"Object Upload\",\r\n                                storage=MinioBackend(bucket_name='django-backend-dev-private'),\r\n                                upload_to=iso_date_prefix)\r\n    ```\r\n\r\n5. Initialize the buckets & set their public policy (OPTIONAL):\\\r\n   This `django-admin` command creates both the private and public buckets in case one of them does not exists,\r\n   and sets the *public* bucket's privacy policy from `private`(default) to `public`.\\\r\n\r\n   ```bash\r\n   python manage.py initialize_buckets\r\n   ```\r\n\r\n   Code reference: [initialize_buckets.py](django_minio_backend/management/commands/initialize_buckets.py).\r\n\r\n### Static Files Support\r\n\r\n**django-minio-backend** allows serving static files from MinIO.\r\nTo learn more about Django static files, see [Managing static files](https://docs.djangoproject.com/en/3.2/howto/static-files/), and [STATICFILES_STORAGE](https://docs.djangoproject.com/en/3.2/ref/settings/#staticfiles-storage).\r\n\r\nTo enable static files support, update your `settings.py`:\r\n\r\n```python\r\nSTATICFILES_STORAGE = 'django_minio_backend.models.MinioBackendStatic'\r\nMINIO_STATIC_FILES_BUCKET = 'my-static-files-bucket'  # replacement for STATIC_ROOT\r\n# Add the value of MINIO_STATIC_FILES_BUCKET to one of the pre-configured bucket lists. eg.:\r\n# MINIO_PRIVATE_BUCKETS.append(MINIO_STATIC_FILES_BUCKET)\r\n# MINIO_PUBLIC_BUCKETS.append(MINIO_STATIC_FILES_BUCKET)\r\n```\r\n\r\nThe value of `STATIC_URL` is ignored, but it must be defined otherwise Django will throw an error.\r\n\r\n**IMPORTANT**\\\r\nThe value set in `MINIO_STATIC_FILES_BUCKET` must be added either to `MINIO_PRIVATE_BUCKETS` or `MINIO_PUBLIC_BUCKETS`,\r\notherwise **django-minio-backend** will raise an exception. This setting determines the privacy of generated file URLs which can be unsigned public or signed private.  \r\n\r\n**Note:** If `MINIO_STATIC_FILES_BUCKET` is not set, the default value (`auto-generated-bucket-static-files`) will be used. Policy setting for default buckets is **private**.\r\n\r\n### Default File Storage Support\r\n\r\n**django-minio-backend** can be configured as a default file storage.\r\nTo learn more, see [DEFAULT_FILE_STORAGE](https://docs.djangoproject.com/en/3.2/ref/settings/#default-file-storage).\r\n\r\nTo configure **django-minio-backend** as the default file storage, update your `settings.py`:\r\n\r\n```python\r\nDEFAULT_FILE_STORAGE = 'django_minio_backend.models.MinioBackend'\r\nMINIO_MEDIA_FILES_BUCKET = 'my-media-files-bucket'  # replacement for MEDIA_ROOT\r\n# Add the value of MINIO_STATIC_FILES_BUCKET to one of the pre-configured bucket lists. eg.:\r\n# MINIO_PRIVATE_BUCKETS.append(MINIO_STATIC_FILES_BUCKET)\r\n# MINIO_PUBLIC_BUCKETS.append(MINIO_STATIC_FILES_BUCKET)\r\n```\r\n\r\nThe value of `MEDIA_URL` is ignored, but it must be defined otherwise Django will throw an error.\r\n\r\n**IMPORTANT**\\\r\nThe value set in `MINIO_MEDIA_FILES_BUCKET` must be added either to `MINIO_PRIVATE_BUCKETS` or `MINIO_PUBLIC_BUCKETS`,\r\notherwise **django-minio-backend** will raise an exception. This setting determines the privacy of generated file URLs which can be unsigned public or signed private.\r\n\r\n**Note:** If `MINIO_MEDIA_FILES_BUCKET` is not set, the default value (`auto-generated-bucket-media-files`) will be used. Policy setting for default buckets is **private**.\r\n\r\n### Health Check\r\n\r\nTo check the connection link between Django and MinIO, use the provided `MinioBackend.is_minio_available()` method.\\\r\nIt returns a `MinioServerStatus` instance which can be quickly evaluated as boolean.\\\r\n\r\n**Example:**\r\n\r\n```python\r\nfrom django_minio_backend import MinioBackend\r\n\r\nminio_available = MinioBackend().is_minio_available()  # An empty string is fine this time\r\nif minio_available:\r\n    print(\"OK\")\r\nelse:\r\n    print(\"NOK\")\r\n    print(minio_available.details)\r\n```\r\n\r\n### Policy Hooks\r\n\r\nYou can configure **django-minio-backend** to automatically execute a set of pre-defined policy hooks.\\\r\nPolicy hooks can be defined in `settings.py` by adding `MINIO_POLICY_HOOKS` which must be a list of tuples.\\\r\nPolicy hooks are automatically picked up by the `initialize_buckets` management command.\r\n\r\nFor an exemplary policy, see the implementation of `def set_bucket_to_public(self)`\r\nin [django_minio_backend/models.py](django_minio_backend/models.py) or the contents\r\nof [examples/policy_hook.example.py](examples/policy_hook.example.py).\r\n\r\n### Consistency Check On Start\r\n\r\nWhen enabled, the `initialize_buckets` management command gets called automatically when Django starts.\\\r\nThis command connects to the configured minIO server and checks if all buckets defined in `settings.py`.\\\r\nIn case a bucket is missing or its configuration differs, it gets created and corrected.\r\n\r\n### Reference Implementation\r\n\r\nFor a reference implementation, see [Examples](examples).\r\n\r\n## Behaviour\r\n\r\nThe following list summarises the key characteristics of **django-minio-backend**:\r\n\r\n* Bucket existence is **not** checked on a save by default.\r\n To enable this guard, set `MINIO_BUCKET_CHECK_ON_SAVE = True` in your `settings.py`.\r\n* Bucket existences are **not** checked on Django start by default.\r\n To enable this guard, set `MINIO_CONSISTENCY_CHECK_ON_START = True` in your `settings.py`.\r\n* Many configuration errors are validated through `AppConfig` but not every error can be captured there.\r\n* Files with the same name in the same bucket are **not** replaced on save by default. Django will store the newer file with an altered file name\r\n To allow replacing existing files, pass the `replace_existing=True` kwarg to `MinioBackend`.\r\n For example: `image = models.ImageField(storage=MinioBackend(bucket_name='images-public', replace_existing=True))`\r\n* Depending on your configuration, **django-minio-backend** may communicate over two kind of interfaces: internal and external.\r\n If your `settings.py` defines a different value for `MINIO_ENDPOINT` and `MINIO_EXTERNAL_ENDPOINT`, then the former will be used for internal communication\r\n between Django and MinIO, and the latter for generating URLs for users. This behaviour optimises the network communication.\r\n See **Networking** below for a thorough explanation\r\n* The uploaded object's content-type is guessed during save. If `mimetypes.guess_type` fails to determine the correct content-type, then it falls back to `application/octet-stream`.\r\n\r\n## Networking and Docker\r\n\r\nIf your Django application is running on a shared host with your MinIO instance, you should consider using the `MINIO_EXTERNAL_ENDPOINT` and `MINIO_EXTERNAL_ENDPOINT_USE_HTTPS` parameters.\r\nThis way most traffic will happen internally between Django and MinIO. The external endpoint parameters are required for external pre-signed URL generation.\r\n\r\nIf your Django application and MinIO instance are running on different hosts, you can omit the `MINIO_EXTERNAL_ENDPOINT` and `MINIO_EXTERNAL_ENDPOINT_USE_HTTPS` parameters, and **django-minio-backend** will default to the value of `MINIO_ENDPOINT`.\r\n\r\nSetting up and configuring custom networks in Docker is not in the scope of this document.\\\r\nTo learn more about Docker networking, see [Networking overview](https://docs.docker.com/network/) and [Networking in Compose](https://docs.docker.com/compose/networking/).\r\n\r\nSee [README.Docker.md](README.Docker.md) for a real-life Docker Compose demonstration.\r\n\r\n## Compatibility\r\n\r\n* Django 4.2 or later\r\n* Python 3.10 or later\r\n* MinIO SDK 7.0.2 or later\r\n\r\n## Contribution\r\n\r\nPlease find the details in [CONTRIBUTE.md](CONTRIBUTE.md)\r\n\r\n## Copyright\r\n\r\n* theriverman/django-minio-backend licensed under the MIT License\r\n* minio/minio-py is licensed under the Apache License 2.0\r\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2019 Kristof  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "A Fork of The django-minio-backend by Kristof Daja (theriverman), provides a wrapper around the MinIO Python Library. Now with Django 5 Support",
    "version": "3.5.3",
    "project_urls": {
        "Homepage": "https://github.com/upchunk/django-minio-backend",
        "Repository": "https://github.com/upchunk/django-minio-backend"
    },
    "split_keywords": [
        "django",
        "minio",
        "backend",
        "django-minio",
        "django-minio-backend",
        "minio-backend"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "55b6759924d1ad123cbd0fe411a9efcc5692dbbcc79421e1761ac938c8d469d0",
                "md5": "cd17a59db0a230c575e5ed0b1cbc98d7",
                "sha256": "62e6747ca7e93437552f42ccc5789078e4f28b01aabc4e8f3ed45add34cc6a22"
            },
            "downloads": -1,
            "filename": "django_minio_backend_five-3.5.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "cd17a59db0a230c575e5ed0b1cbc98d7",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 27455,
            "upload_time": "2024-03-06T08:53:23",
            "upload_time_iso_8601": "2024-03-06T08:53:23.217300Z",
            "url": "https://files.pythonhosted.org/packages/55/b6/759924d1ad123cbd0fe411a9efcc5692dbbcc79421e1761ac938c8d469d0/django_minio_backend_five-3.5.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f4e473dfceb36b5cfec1e50619a318b5b9aeb8d91baebc5b0123bab97447ed89",
                "md5": "0c240e4ff2ec79a8e91554325fdaedb4",
                "sha256": "b1696e1a673fd1505e08c8cf5098ac13f9767ac8c51ab8ed2219467448c5da7a"
            },
            "downloads": -1,
            "filename": "django-minio-backend-five-3.5.3.tar.gz",
            "has_sig": false,
            "md5_digest": "0c240e4ff2ec79a8e91554325fdaedb4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 26862,
            "upload_time": "2024-03-06T08:53:24",
            "upload_time_iso_8601": "2024-03-06T08:53:24.476279Z",
            "url": "https://files.pythonhosted.org/packages/f4/e4/73dfceb36b5cfec1e50619a318b5b9aeb8d91baebc5b0123bab97447ed89/django-minio-backend-five-3.5.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-06 08:53:24",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "theriverman",
    "github_project": "django-minio-backend",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "Django",
            "specs": [
                [
                    ">=",
                    "2.2.2"
                ]
            ]
        },
        {
            "name": "minio",
            "specs": [
                [
                    ">=",
                    "7.0.2"
                ]
            ]
        },
        {
            "name": "Pillow",
            "specs": []
        },
        {
            "name": "setuptools",
            "specs": []
        }
    ],
    "lcname": "django-minio-backend-five"
}
        
Elapsed time: 0.19343s