Skip to main content

Multiple object storage backends for Django (MinIO, Backblaze B2, and more)

Project description

Django Storage

Supported backends

  • MinIO
  • Backblaze B2

Installation

pip install django-object-storage

Usage

BackBlazeB2

Reads configuration from Django settings when not provided explicitly:

# 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:

# 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
# 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"

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_object_storage-0.2.0.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_object_storage-0.2.0-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file django_object_storage-0.2.0.tar.gz.

File metadata

  • Download URL: django_object_storage-0.2.0.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for django_object_storage-0.2.0.tar.gz
Algorithm Hash digest
SHA256 ca710c346c9cde849a6a021130024145d6efb41cead3d74a5f76876a81764f07
MD5 e0560d652c308f92145f7f4f7ee38d1c
BLAKE2b-256 3db0b0057e40d729804ed3c92c993dd2eb3f3eb2f7f686b9acbf16947e8abb6e

See more details on using hashes here.

File details

Details for the file django_object_storage-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_object_storage-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3cc277d83dac0ffb237f47ce8f9052a8ffa937ce56deabaac5241221e8900cc7
MD5 cdd8c3245d6821b7e4b58b9b2f5685ac
BLAKE2b-256 d5912850271140ce0319fcc6848eacb137143a9e150bb451897b1cb0959a863b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page