Skip to content
New issue

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

Enabling Customization of Storage Backends #105

Merged

Conversation

zachbellay
Copy link
Contributor

Overview

This PR enables customization of storage backends. It introduces a new setting IMPORT_EXPORT_CELERY_STORAGE, and can be used as follows:

# myapp/settings.py
...
IMPORT_EXPORT_CELERY_STORAGE = "storages.backends.s3boto3.S3Boto3Storage"
...

By setting this field in your django settings, you will be able to customize where all files related to django-import-export-celery go.

In my case, I would like these files to have more access control, so I would do something like this:

IMPORT_EXPORT_CELERY_STORAGE = 'utility.s3storages.PrivateMediaStorage'

Rationale

This PR is necessary because the only way to customize the storage backend is by modifying the default_storage setting in django. However, since this applies globally, if you were to set default_storage to a private/protected storage backend, you would be unable to have publicly accessible media, hence this request for change.

@timthelion
Copy link
Member

This works for now, but I've run into the exact thing you're facing and TBH I think we should modify Django to be able to set a flag as to whether a FileField should be private or not.

@timthelion timthelion merged commit 5a54a81 into auto-mat:master Jul 29, 2023
1 check passed
@zachbellay zachbellay deleted the feat/customizable-storage-backend branch July 30, 2023 03:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants