chore: make all backends point to S3 in the documentation example

This commit is contained in:
Yohan Boniface 2024-12-13 11:20:33 +01:00
parent 45a0ec5d42
commit 7c808393f0

View file

@ -40,24 +40,40 @@ Then, change the `STORAGES` settings with something like this:
``` ```
STORAGES = { STORAGES = {
"default": { "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": { "data": {
# Whatch out, this is a dedicated uMap class!
"BACKEND": "umap.storage.s3.S3DataStorage", "BACKEND": "umap.storage.s3.S3DataStorage",
"OPTIONS": { "OPTIONS": {
"access_key": "xxx", "access_key": "xxx",
"secret_key": "yyy", "secret_key": "yyy",
"bucket_name": "umap", "bucket_name": "umap-data",
"region_name": "eu",
"endpoint_url": "http://127.0.0.1:9000", "endpoint_url": "http://127.0.0.1:9000",
}, },
}, },
"staticfiles": { "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. 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). See more about the configuration on the [django-storages documentation](https://django-storages.readthedocs.io/en/latest/backends/amazon-S3.html).