I am attempting to get mongodb + gridfs working for django so that I can serve files out of django, but upon programmatically creating a new file, I get this error. I'm not sure which documents to follow as it appears some of them are out of date.
Here is my settings.py:
DATABASES = {
'files': {
'ENGINE': 'django_mongodb_engine',
'NAME': 'files',
'USER': 'files',
'PASSWORD': 'files',
'HOST': 'localhost',
'PORT': 27017,
'SUPPORTS_TRANSACTIONS': False,
}
}
DEFAULT_FILE_STORAGE = 'mongo_storage.storage.GridFSStorage'
GRIDFS_DATABASE = 'files'
And, in my model, I'm simply using a file field:
data = models.FileField(upload_to="/tmp/uploads")
Then, I'm creating a new file ...:
internal_file = File()
internal_file.data.save(checksum, open(path).read())
That is when I get the attribute error.
Do I need to configure my model differently, not call the save() method explicitly?