seed icon indicating copy to clipboard operation
seed copied to clipboard

upload media to s3

Open loydbanks opened this issue 2 years ago • 4 comments

Any background context you want to provide?

When we upload files, we want to send them to s3 to limit storing locally

What's this PR do?

send uploaded files to an s3 bucket

How should this be manually tested?

first make sure you have no docker containers, images or volumes, clear everything. sudo docker volume create seed_media sudo docker volume create seed_pgdata sudo docker-compose up db-postgres db-redis sudo docker-compose up --build web web-celery

What are the relevant tickets?

#3446

Screenshots (if appropriate)

loydbanks avatar Jul 27 '22 10:07 loydbanks

For testing, we could use minio to emulate s3 buckets, if that is an option and/or needed. https://min.io

nllong avatar Jul 27 '22 18:07 nllong

@loydbanks thank you for your pull request. Can you work on the two main issues that I found during testing on my machine locally which is adding back in line 19 of config/settings/common.py (PROTOCOL) and figuring out the equivalent of get_available_name method for default_storage? I created a branch that adds back in the PROTOCOL line if you want to refer to that. I believe that I also ran the precommit test and had it fix those issues.

After that is done I will test out the s3 functionality.

anchapin avatar Aug 04 '22 20:08 anchapin

All storage classes are subclasses of Storage, which has that function - https://docs.djangoproject.com/en/4.0/ref/files/storage/#django.core.files.storage.Storage.get_available_name

I fixed line 19 in config/settings/common.py

loydbanks avatar Aug 08 '22 08:08 loydbanks

I created an issue in SEED (#3446) and linked it to this PR. I also ran precommit on this branch and linked it to that issue. I'm looking into dealing with the django test error.

anchapin avatar Aug 09 '22 14:08 anchapin