diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 1d5060b..1efe7a3 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -13,7 +13,6 @@ env: DJANGO_MINIO_STORAGE_ACCESS_KEY: minioAccessKey DJANGO_MINIO_STORAGE_SECRET_KEY: minioSecretKey DJANGO_STORAGE_BUCKET_NAME: django-storage - DJANGO_MINIO_STORAGE_MEDIA_URL: http://minio:9000/django-storage jobs: lint-python: name: Lint Python diff --git a/README.md b/README.md index 815e257..7e72311 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ To do so, before running any `docker compose` commands, set any of the environme The Django server must be informed about the changes: * When running the "Develop with Docker" configuration, override the environment variables: - * `DJANGO_MINIO_STORAGE_MEDIA_URL`, using the port from `DOCKER_MINIO_PORT`. + * `DJANGO_MINIO_STORAGE_ENDPOINT`, using the port from `DOCKER_MINIO_PORT`. * When running the "Develop Natively" configuration, override the environment variables: * `DJANGO_DATABASE_URL`, using the port from `DOCKER_POSTGRES_PORT` * `DJANGO_CELERY_BROKER_URL`, using the port from `DOCKER_RABBITMQ_PORT` diff --git a/bats_ai/settings.py b/bats_ai/settings.py index 0b96310..24d1bbf 100644 --- a/bats_ai/settings.py +++ b/bats_ai/settings.py @@ -57,7 +57,23 @@ def DATABASES(self): # noqa class DevelopmentConfiguration(BatsAiMixin, DevelopmentBaseConfiguration): - pass + SECRET_KEY = 'secretkey' # Dummy value for local development configuration + + DEFAULT_FILE_STORAGE = 'minio_storage.storage.MinioMediaStorage' + MINIO_STORAGE_ENDPOINT = values.Value( + 'localhost:9000', + ) + MINIO_STORAGE_USE_HTTPS = values.BooleanValue(False) + MINIO_STORAGE_ACCESS_KEY = values.SecretValue() + MINIO_STORAGE_SECRET_KEY = values.SecretValue() + MINIO_STORAGE_MEDIA_BUCKET_NAME = values.Value( + environ_name='DJANGO_STORAGE_BUCKET_NAME', + environ_required=True, + ) + MINIO_STORAGE_AUTO_CREATE_MEDIA_BUCKET = True + MINIO_STORAGE_AUTO_CREATE_MEDIA_POLICY = 'READ_WRITE' + MINIO_STORAGE_MEDIA_USE_PRESIGNED = True + MINIO_STORAGE_MEDIA_URL = 'http://127.0.0.1:9000/rdwatch' class TestingConfiguration(BatsAiMixin, TestingBaseConfiguration): diff --git a/dev/.env.docker-compose b/dev/.env.docker-compose index 9daa15e..1e26fae 100644 --- a/dev/.env.docker-compose +++ b/dev/.env.docker-compose @@ -5,5 +5,5 @@ DJANGO_MINIO_STORAGE_ENDPOINT=minio:9000 DJANGO_MINIO_STORAGE_ACCESS_KEY=minioAccessKey DJANGO_MINIO_STORAGE_SECRET_KEY=minioSecretKey DJANGO_STORAGE_BUCKET_NAME=django-storage -DJANGO_MINIO_STORAGE_MEDIA_URL=http://minio:9000/django-storage +DJANGO_MINIO_STORAGE_ENDPOINT=minio:9000 DJANGO_CORS_ORIGIN_WHITELIST=http://localhost:3000 \ No newline at end of file diff --git a/dev/.env.docker-compose-native b/dev/.env.docker-compose-native index 7c57700..e8a2da4 100644 --- a/dev/.env.docker-compose-native +++ b/dev/.env.docker-compose-native @@ -1,7 +1,7 @@ DJANGO_CONFIGURATION=DevelopmentConfiguration DJANGO_DATABASE_URL=postgres://postgres:postgres@localhost:5432/django DJANGO_CELERY_BROKER_URL=amqp://localhost:5672/ -DJANGO_MINIO_STORAGE_ENDPOINT=localhost:9000 +DJANGO_MINIO_STORAGE_ENDPOINT=minio:9000 DJANGO_MINIO_STORAGE_ACCESS_KEY=minioAccessKey DJANGO_MINIO_STORAGE_SECRET_KEY=minioSecretKey DJANGO_STORAGE_BUCKET_NAME=django-storage diff --git a/setup.py b/setup.py index 9c4d563..7678b04 100644 --- a/setup.py +++ b/setup.py @@ -61,6 +61,7 @@ 'django-debug-toolbar', 'django-s3-file-field[minio]', 'django-click', + 'django-minio-storage>=0.5.2', 'ipython', 'tox', ] diff --git a/tox.ini b/tox.ini index 28eb917..a8d17a9 100644 --- a/tox.ini +++ b/tox.ini @@ -58,13 +58,14 @@ commands = [testenv:check-migrations] setenv = - DJANGO_CONFIGURATION = TestingConfiguration + DJANGO_CONFIGURATION = DevelopmentConfiguration passenv = DJANGO_CELERY_BROKER_URL DJANGO_DATABASE_URL DJANGO_MINIO_STORAGE_ACCESS_KEY DJANGO_MINIO_STORAGE_ENDPOINT DJANGO_MINIO_STORAGE_SECRET_KEY + DJANGO_STORAGE_BUCKET_NAME extras = dev commands =