We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
We currently use a few custom settings (e.g.: AFIP_KEY_STORAGE, AFIP_CERT_STORAGE) to define storages.
AFIP_KEY_STORAGE
AFIP_CERT_STORAGE
Django 4.2 implements a standard mechanism for defining custom storages. We should move over to use that.
See: https://docs.djangoproject.com/en/4.2/releases/4.2/#custom-file-storages
The text was updated successfully, but these errors were encountered:
One example of custom storage backend could be the following. This setting makes files uploaded to S3 private.
storages.py
from django.core.files.storage import get_storage_class from storages.backends.s3boto3 import S3Boto3Storage class PrivateMediaStorage(S3Boto3Storage): location = "media/private" default_acl = "private" file_overwrite = False custom_domain = False def __init__(self): super().__init__() self.bucket_name = settings.AWS_PRIVATE_STORAGE_BUCKET_NAME def select_private_storage(): # important private_storage_class = get_storage_class(settings.PRIVATE_FILE_STORAGE) return private_storage_class() # instantiate the storage
production.py
PRIVATE_FILE_STORAGE = "my_project.utils.storages.PrivateMediaStorage" AFIP_PDF_STORAGE = PRIVATE_FILE_STORAGE
Sorry, something went wrong.
No branches or pull requests
We currently use a few custom settings (e.g.:
AFIP_KEY_STORAGE
,AFIP_CERT_STORAGE
) to define storages.Django 4.2 implements a standard mechanism for defining custom storages. We should move over to use that.
See: https://docs.djangoproject.com/en/4.2/releases/4.2/#custom-file-storages
The text was updated successfully, but these errors were encountered: