From 7c808393f08ab67804b05efc3ff24246429fbff9 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Fri, 13 Dec 2024 11:20:33 +0100 Subject: [PATCH] chore: make all backends point to S3 in the documentation example --- docs/config/storage.md | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/docs/config/storage.md b/docs/config/storage.md index 140c53fbc..aa233c92b 100644 --- a/docs/config/storage.md +++ b/docs/config/storage.md @@ -40,24 +40,40 @@ Then, change the `STORAGES` settings with something like this: ``` STORAGES = { "default": { - "BACKEND": "django.core.files.storage.FileSystemStorage", + "BACKEND": "storages.backends.s3.S3Storage", + "OPTIONS": { + "access_key": "xxx", + "secret_key": "yyy", + "bucket_name": "umap-pictograms", + "endpoint_url": "http://127.0.0.1:9000", + }, }, "data": { + # Whatch out, this is a dedicated uMap class! "BACKEND": "umap.storage.s3.S3DataStorage", "OPTIONS": { "access_key": "xxx", "secret_key": "yyy", - "bucket_name": "umap", - "region_name": "eu", + "bucket_name": "umap-data", "endpoint_url": "http://127.0.0.1:9000", }, }, "staticfiles": { - "BACKEND": "umap.storage.staticfiles.UmapManifestStaticFilesStorage", + "BACKEND": "storages.backends.s3.S3Storage", + "OPTIONS": { + "access_key": "xxx", + "secret_key": "yyy", + "bucket_name": "umapstatics", + "endpoint_url": "http://127.0.0.1:9000", + }, }, } ``` +As you can see in this example, both `staticfiles` and `default` use the storage class provided +by `django-storages` (`storages.backends.s3.S3Storage`), but the `data` one uses a specific class +(`umap.storage.s3.S3DataStorage`). + In order to store old versions of a layer, the versioning should be activated in the bucket. See more about the configuration on the [django-storages documentation](https://django-storages.readthedocs.io/en/latest/backends/amazon-S3.html).