When using Django's DefaultStorage it's possible to open and read a file something like this:
from django.core.files.storage import default_storage
file = default_storage.open("dir/file.txt", mode="rb")
data = file.read()
When using python's own open() method, it's best to close() the file afterwards, or use a with open("dir/file.txt") as file: construction.
But reading the docs for Django's Storage classes, and browsing the source, I don't see a close() equivalent.
So my questions are:
- Should a file opened with Django's Default Storage be closed?
- If so, how?
- If not, why isn't it necessary?