2👍
✅
upload_to
is used for uploading, You’re assigning the string name directly. upload_to takes action only when you create a FileField object (by uploading from a form).
You can read the documentation here
1👍
upload_to
is a directory relative to your project root where the files you upload are meant to be stored. But you are not assigning it a file, you are assigning it a string, which seems to be causing your FileField
to assume you have a file named some_file.pdf
in your MEDIA_ROOT
.
Repeat: assigning a filename (string) makes FileField
to ignore the path defined in upload_to
and takes the given string as the real path.
Good luck 🙂
Source:stackexchange.com