2

How can I save absolute paths (like /var/files/.. , or s3://bucket/path) in a table containing file field?
Django by default uses MEDIA_ROOT as a prefix, and store relative paths.
I use the django-storages package for S3 backend.

user3599803
  • 6,435
  • 17
  • 69
  • 130
  • Django FileField is not designed to work that way, why do you want to store the absolute paths? You can get the paths from the field after reading the row from the DB – Iain Shelvington Aug 31 '19 at 06:30
  • The reason for this, is I want to write to different buckets based on the request. And hence I prefer the bucket stored in the DB as well – user3599803 Sep 06 '19 at 05:48

0 Answers0