I have implemented Celery task that downloads imagefile from web and stores the imagefile with metadata into the database.
Actually, I'm using Django ImageFieldModel
so that the metadata is stored in the database and file is stored in the Azure Blob Storage.
It is working well in demo environment. Imagefile is stored in filesystem which is same physical location with a worker.
However, it has a problem in deployment environment. The file storage is Azure Blob Storage.
Sometimes, Imagefile is not stored. Metadata is sorted in database.
Does anybody know why this happens.
How I store the imagefile is really simple.
new_contents = ImageContents(user = user, privacy = privacy)
new_contents.thumb_file.save('filename.jpeg', thumb_file, save = True)
new_contents.save()
I have implemented django-storage for Azure Blob Storage.
This is code that opens the file in django app:
def _open(self, name, mode='rb'):
inMemFile = StringIO.StringIO(self.blob.get_blob(self.container, name))
inMemFile.name = name
inMemFile.mode = mode
return File(inMemFile)