I have an existing file on disk (say /folder/file.txt) and a FileField model field in Django.
When I do
instance.field = File(file('/folder/file.txt'))
instance.save()
it re-saves the file as file_1.txt (the next time it’s _2, etc.).
I understand why, but I don’t want this behavior – I know the file I want the field to be associated with is really there waiting for me, and I just want Django to point to it.
How?
If you want to do this permanently, you need to create your own FileStorage class
Now in your model, you use your modified MyFileStorage