Skip to content

I have to add staticfiles into storage = [] #63

@DokinsKING

Description

@DokinsKING

I created the following configuration:

DEFAULT_FILE_STORAGE = 'django_minio_backend.storage.MinioBackend'


STORAGES = {  # -- ADDED IN Django 5.1
    "default": {
        "BACKEND": "django_minio_backend.models.MinioBackend",
    }
}

MINIO_ENDPOINT = 'localhost:9000/'
MINIO_ACCESS_KEY = 'there is real key'
MINIO_SECRET_KEY = 'there is real key'
MINIO_CONSISTENCY_CHECK_ON_START = True
MINIO_USE_HTTPS = False
MINIO_PRIVATE_BUCKETS = [
    'images'
]

MINIO_MEDIA_FILES_BUCKET = 'images'  # replacement for MEDIA_ROOT
MINIO_BUCKET_CHECK_ON_SAVE = True  # Default: True // Creates bucket if missing, then save

But I got the following error indicating that I missed configuring staticfiles:

    fn(*args, **kwargs)
    ~~^^^^^^^^^^^^^^^^^
  File "C:\Users\KKK\AppData\Local\Programs\Python\Python313\Lib\site-packages\django\__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
    ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\KKK\AppData\Local\Programs\Python\Python313\Lib\site-packages\django\apps\registry.py", line 124, in populate
    app_config.ready()
    ~~~~~~~~~~~~~~~~^^
  File "C:\Users\KKK\AppData\Local\Programs\Python\Python313\Lib\site-packages\django_minio_backend\apps.py", line 36, in ready
    staticfiles_backend = storages["staticfiles"]["BACKEND"]
                          ~~~~~~~~^^^^^^^^^^^^^^^
KeyError: 'staticfiles'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions