[action required] Upgrade your storage settings before pulpcore 3.85

Django 4.2 deprecated DEFAULT_FILE_STORAGE and STATIC_FILE_STORAGE in favor of STORAGES.

As of the Pulpcore 3.70 release (February 4, 2025), deployments customizing these settings must update them to the new form. This update will be required for Pulpcore 3.85, expected in August 2025.

No action is required if these settings are not customized or you don’t plan on upgrading.

Migration Guide

I’ll present two ways for updating the settings aimed at different configuration methods:

1. Defined in setting.py

If you only define your settings in settings.py, using the new structure is the most straightforward way.

  1. Define you default backend in the STORAGES["default"]["BACKEND"] dict.
  2. Translate the backend names and put them in STORAGES["default"]["OPTIONS"] dict.
  3. Add the default static file storage to ensure it exists.
  4. Remove all the deprecated settings.
Example with S3
# removed
DEFAULT_FILE_STORAGE = "storages.backends.s3boto3.S3Boto3Storage"
AWS_ACCESS_KEY_ID = "myaccesskey"
AWS_SECRET_ACCESS_KEY = "mysecretkey"
AWS_S3_REGION_NAME = "eu-central-1"
AWS_S3_ADDRESSING_STYLE = "path"
AWS_S3_SIGNATURE_VERSION = "s3v4"
AWS_STORAGE_BUCKET_NAME = "pulp3"
AWS_S3_ENDPOINT_URL = "http://minio:9000"
AWS_DEFAULT_ACL = "@none None"

STATIC_FILE_STORAGE=...  # remove if defined
# added
STORAGES = {
    "default": {
        "BACKEND": "storages.backends.s3boto3.S3Boto3Storage",
        "OPTIONS": {
            "access_key": "myaccesskey",
            "secret_key": "mysecretkey",
            "region_name": "eu-central-1",
            "addressing_style": "path",
            "signature_version": "s3v4",
            "bucket_name": "pulp3",
            "endpoint_url": "http://minio:9000",
            "default_acl": "@none None",
        },
    },
    "staticfiles": {
        "BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage",
    },
}

2. Defined as environment variables

If you want to preserve simple key-value declarations, you may use the dynaconf syntax for merging.

  1. Define your default backend using STORAGES__default__BACKEND={backend}.
  2. Update the keys for the deprecated option names like: STORAGES__default__OPTIONS__{option-name}={backend-value}.

Note the merge syntax uses double underscore separator.

Example with S3
# removed
DEFAULT_FILE_STORAGE = "storages.backends.s3boto3.S3Boto3Storage"
AWS_ACCESS_KEY_ID = "myaccesskey"
AWS_SECRET_ACCESS_KEY = "mysecretkey"
AWS_S3_REGION_NAME = "eu-central-1"
AWS_S3_ADDRESSING_STYLE = "path"
AWS_S3_SIGNATURE_VERSION = "s3v4"
AWS_STORAGE_BUCKET_NAME = "pulp3"
AWS_S3_ENDPOINT_URL = "http://minio:9000"
AWS_DEFAULT_ACL = "@none None"
# added
STORAGES__default__BACKEND="storages.backends.s3boto3.S3Boto3Storage"
STORAGES__default__OPTIONS__access_key="myaccesskey"
STORAGES__default__OPTIONS__secret_key="mysecretkey"
STORAGES__default__OPTIONS__region_name="eu-central-1"
STORAGES__default__OPTIONS__addressing_style="path"
STORAGES__default__OPTIONS__signature_version="s3v4"
STORAGES__default__OPTIONS__bucket_name="pulp3"
STORAGES__default__OPTIONS__endpoint_url="http://minio:9000"
STORAGES__default__OPTIONS__default_acl="@none None"

Backend Options

For convenience, here is a compendium of the names’ equivalence for some storage backend options.
For a complete reference of your specific backend, refer to the django-storages documentation.

storages.backends.s3boto3.S3Boto3Storage
AWS_S3_SESSION_PROFILE=session_profile
AWS_S3_ACCESS_KEY_ID=access_key
AWS_ACCESS_KEY_ID=access_key
AWS_S3_SECRET_ACCESS_KEY=secret_key
AWS_SECRET_ACCESS_KEY=secret_key
AWS_SESSION_TOKEN=security_token
AWS_SECURITY_TOKEN=security_token
AWS_STORAGE_BUCKET_NAME=bucket_name
AWS_S3_OBJECT_PARAMETERS=object_parameters
AWS_DEFAULT_ACL=default_acl
AWS_QUERYSTRING_AUTH=querystring_auth
AWS_S3_MAX_MEMORY_SIZE=max_memory_size
AWS_QUERYSTRING_EXPIRE=querystring_expire
AWS_S3_URL_PROTOCOL=url_protocol
AWS_S3_FILE_OVERWRITE=file_overwrite
AWS_LOCATION=location
AWS_IS_GZIPPED=gzip
GZIP_CONTENT_TYPES=gzip_content_types
AWS_S3_REGION_NAME=region_name
AWS_S3_USE_SSL=use_ssl
AWS_S3_VERIFY=verify
AWS_S3_ENDPOINT_URL=endpoint_url
AWS_S3_ADDRESSING_STYLE=addressing_style
AWS_S3_PROXIES=proxies
AWS_S3_TRANSFER_CONFIG=transfer_config
AWS_S3_CUSTOM_DOMAIN=custom_domain
AWS_CLOUDFRONT_KEY=cloudfront_key
AWS_CLOUDFRONT_KEY_ID=cloudfront_key_id
AWS_S3_SIGNATURE_VERSION=signature_version
AWS_S3_CLIENT_CONFIG=client_config
storages.backends.azure_storage.AzureStorage
AZURE_CONNECTION_STRING=connection_string
AZURE_ACCOUNT_KEY=account_key
AZURE_ACCOUNT_NAME=account_name
AZURE_TOKEN_CREDENTIAL=token_credential
AZURE_SAS_TOKEN=sas_token
AZURE_CONTAINER=azure_container
AZURE_SSL=azure_ssl
AZURE_UPLOAD_MAX_CONN=upload_max_conn
AZURE_CONNECTION_TIMEOUT_SECS=timeout
AZURE_BLOB_MAX_MEMORY_SIZE=max_memory_size
AZURE_URL_EXPIRATION_SECS=expiration_secs
AZURE_OVERWRITE_FILES=overwrite_files
AZURE_LOCATION=location
AZURE_ENDPOINT_SUFFIX=endpoint_suffix
AZURE_CUSTOM_DOMAIN=custom_domain
AZURE_CACHE_CONTROL=cache_control
AZURE_OBJECT_PARAMETERS=object_parameters
AZURE_CLIENT_OPTIONS=client_options
AZURE_API_VERSION=api_version
storages.backends.gcloud.GoogleCloudStorage
GS_IAM_SIGN_BLOB=iam_sign_blob
GS_SA_EMAIL=sa_email
GS_BUCKET_NAME=bucket_name
GS_PROJECT_ID=project_id
GS_IS_GZIPPED=gzip
GZIP_CONTENT_TYPES=gzip_content_types
GS_CREDENTIALS=credentials
GS_DEFAULT_ACL=default_acl
GS_QUERYSTRING_AUTH=querystring_auth
GS_FILE_OVERWRITE=file_overwrite
GS_MAX_MEMORY_SIZE=max_memory_size
GS_BLOB_CHUNK_SIZE=blob_chunk_size
GS_OBJECT_PARAMETERS=object_parameters
GS_CUSTOM_ENDPOINT=custom_endpoint
GS_LOCATION=location
GS_EXPIRATION=expiration
1 Like