Open alexolivas opened 2 years ago
I see your problem and I think your proposal to reuse MINIO_CONSISTENCY_CHECK_ON_START
is a good call. I would like to avoid introducing yet another configuration parameter.
You're right about the proposed changes in those two places, but in the case of MinioBackendStatic
, the last line calling self.set_bucket_to_public()
should be indented into the if branch as well. Otherwise it may raise an Exception while trying to manipulate a non-existing bucket. At least that's what I suspect to happen.
Please feel free to open a PR, and I'll check it out ASAP.
FYI I've not forgotten about this, I will open up a PR as soon as I free up a bit from work. I calculate sometime around mid next week.
Note: I'm only running into this issue in my CI/CD pipeline, because I am using tox to create an isolated python 3.8 environment to run all my django/python unit tests.
In my
settings.py
I setSTATIC_FILES_STORAGE
to useMinioBackendStatic
to serve all my static files from my minio server, because of this I get a ConnectionError when the tox environment starts up, this library makes a call to check the buckets exist at django_minio_backend/apps.py#L32.Screenshot of stacktrace on startup
Because this is an isolated python environment specifically used for testing, it can't really reach out to ensure any buckets exist. By looking at the source code, it doesn't seem like there's a way to prevent the call to
mbs.check_bucket_existence()
unless I don't setSTATICFILES_STORAGE = "django_minio_backend.models.MinioBackendStatic"
in mysettings.py
file whenever I'm running this tox environment, which is not an elegant solution IMO.I'm basically looking for any guidance on how to get around this a bit more elegantly. I'm also open to opening up a pull request to introduce an additional (or reuse
MINIO_CONSISTENCY_CHECK_ON_START
) configuration setting in that line of code to not check for bucket existence e.g.There are 2 places where this needs to be done, in apps.py:
and in models.py