Metadata-Version: 2.4
Name: django-object-storage
Version: 0.2.0
Summary: Multiple object storage backends for Django (MinIO, Backblaze B2, and more)
Author: Kiều Văn Chương
License: MIT
Project-URL: Homepage, https://github.com/vanchuongkieu/django-object-storage
Project-URL: Repository, https://github.com/vanchuongkieu/django-object-storage
Project-URL: Documentation, https://github.com/vanchuongkieu/django-object-storage#readme
Keywords: django,storage,object-storage,minio,backblaze,b2,s3,django-storage,django-object-storage
Classifier: Development Status :: 3 - Alpha
Classifier: Framework :: Django
Classifier: Framework :: Django :: 3.2
Classifier: Framework :: Django :: 4.0
Classifier: Framework :: Django :: 4.1
Classifier: Framework :: Django :: 4.2
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: django>=3.2
Requires-Dist: minio>=7.1.0
Requires-Dist: requests>=2.25.0

# Django Storage

## Supported backends

- MinIO
- Backblaze B2

## Installation

```bash
pip install django-object-storage
```

## Usage

### BackBlazeB2

_Reads configuration from Django settings when not provided explicitly:_

```python
# For Django 4.2+

STORAGE_B2_APP_KEY = ""
STORAGE_B2_ACCOUNT_ID = ""
STORAGE_B2_BUCKET_NAME = ""
STORAGE_B2_BUCKET_ID = ""

STORAGES = {
    "default": {
        "BACKEND": "django_object_storage.b2.B2Storage",
    },
}

# Or for Django 4.2+ with options
STORAGES = {
    "default": {
        "BACKEND": "django_object_storage.b2.B2Storage",
        "OPTIONS": {
            "account_id": "",
            "app_key": "",
            "bucket_name": "",
            "bucket_id": "",
        },
    },
}

# For Django versions below 4.2
DEFAULT_FILE_STORAGE = "django_object_storage.b2.B2Storage"
```

### MinIO

Reads configuration from Django settings when not provided explicitly:

```python
# For Django 4.2+

STORAGE_MINIO_BUCKET_NAME = ""
STORAGE_MINIO_ENDPOINT = "" # s3.example.com
STORAGE_MINIO_ACCESS_KEY = ""
STORAGE_MINIO_SECRET_KEY = ""
STORAGE_MINIO_SECURE = True  # True or False

STORAGES = {
    "default": {
        "BACKEND": "django_object_storage.minio.MinIOStorage",
    },
}

# Or for Django 4.2+ with options
STORAGES = {
    "default": {
        "BACKEND": "django_object_storage.minio.MinIOStorage",
        "OPTIONS": {
            "bucket_name": "",
            "endpoint": "", # s3.example.com
            "access_key": "",
            "secret_key": "",
            "secure": True,  # True or False
        },
    },
}

# For Django versions below 4.2
DEFAULT_FILE_STORAGE = "django_object_storage.minio.MinIOStorage"
```

### Auto Static Files Storage

- DEBUG = True -> StaticFilesStorage
- DEBUG = False -> ManifestStaticFilesStorage

```python
# For Django 4.2+

STORAGES = {
    "default": {
        "BACKEND": "django_object_storage.staticfiles.StaticFilesStorage",
    },
}

# For Django versions below 4.2

DEFAULT_FILE_STORAGE = "django_object_storage.staticfiles.StaticFilesStorage"
```
