Skip to main content

Django storage backend to use MinIO as file storage. It is wrapper over "minio" library.

Project description

Django Minio Connector

Django storage backend to use Minio Server as file storage. It is wrapper over "minio" library.

Installation

At first, you need to have working minio server. How to do that you can found at Minio Quickstart Guide.

Install Django Minio Storage from pip:

pip install django-minio-connector

Add configuration of Minio storage to your projects settings file:

from django_minio_connector import MinIOStorage

STORAGES = {
    "staticfiles": {
        "BACKEND": MinIOStorage,
        "OPTIONS": {
            "MINIO_ENDPOINT": 'your_minio_server_address',
            "MINIO_ROOT_USER": "your_minio_server_access_key",
            "MINIO_ROOT_PASSWORD": "your_minio_server_secret_key",
            'MINIO_USE_HTTPS': False,
            'MINIO_BUCKET_NAME': 'static-bucket-name',
            'MINIO_BUCKET_POLICY': {
                "Version": "2012-10-17",
                "Statement": [
                    {
                        "Effect": "Allow",
                        "Principal": {"AWS": "*"},
                        "Action": [
                            "s3:GetBucketLocation",
                            "s3:ListBucket"
                        ],
                        "Resource": f"arn:aws:s3:::static"
                    },
                    {
                        "Effect": "Allow",
                        "Principal": {"AWS": "*"},
                        "Action": "s3:GetObject",
                        "Resource": f"arn:aws:s3:::static/*"
                    }
                ]
            },
            'MINIO_PRESIGNED_URL': False,
        },
    },
    'default': {
        'BACKEND': MinIOStorage,
        "OPTIONS": {
            "MINIO_ENDPOINT": 'your_minio_server_address',
            "MINIO_ROOT_USER": "your_minio_server_access_key",
            "MINIO_ROOT_PASSWORD": "your_minio_server_secret_key",
            'MINIO_USE_HTTPS': False,
            'MINIO_BUCKET_NAME': 'media-bucket-name',
        },

    }
}

For using MinIO server in development stage could install it by Docker MinIO Quickstart Guide

Demo MinIO server and it's credentials can be found at MinIO console.

MinIO library documentation Python Client API Reference

More information about file storages can be found at Django Docs.

Description of STORAGE settings Settings

Currently tested only at Django 5.1. Does not work on earlier versions because the DEFAULT_FILE_STORAGE and STATICFILES_STORAGE settings is removed.

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_minio_connector-0.0.2.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

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

django_minio_connector-0.0.2-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file django_minio_connector-0.0.2.tar.gz.

File metadata

  • Download URL: django_minio_connector-0.0.2.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.4

File hashes

Hashes for django_minio_connector-0.0.2.tar.gz
Algorithm Hash digest
SHA256 9d6bb59a95838e5d50c9bf622f2b30a3ce5413ae4d4109a8bf43dbc3eebbb4e7
MD5 d275416b90f756e3cb16333d993cd3e6
BLAKE2b-256 b83397397de77356e77ee2982af18a77e47191039ad0f00f6d4e5393c7d4a522

See more details on using hashes here.

File details

Details for the file django_minio_connector-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for django_minio_connector-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8962deb7b30c2272ce830a476cdc627fe5ff56e6d446a65942f617d22b65cde8
MD5 a279d6bd4d07134dfce08cf43071b2dc
BLAKE2b-256 1d82676b859a3b9d6464b9aba168bf2fd69a60649df3233a4e939b85e54550de

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