Home > Mobile >  Change FileField to CharField or change file location to S3
Change FileField to CharField or change file location to S3

Time:11-25

I currently have my files saved in my own server using FileField. And I want to make a migration for saving my files in S3. I was thinking in replace the FileField to a CharField keeping the file names and then, add the domain before it, to keep the track of the files. And then I'd migrate to S3.

Is there a simpler way to make this in Django? Is it even possible to change a FileField to a CharField and keep the files path as a string?

CodePudding user response:

Hey I was succesful in leaving the FileFields as is and using django-storages. Then using the storage injected into the file field to make it use s3. I did not have to migrate the database for this. https://django-storages.readthedocs.io/en/latest/backends/amazon-S3.html

  • Related