python - Load rotated image in the same page -


i have django site , theres page user clicks on "rotate image" button , page should reloaded image rotated.

the problem works locally, in production i'm having problems (probably due time upload , load image again).

in view, code this:

def rotateleft(request,idredacao):     obj = myobject.objects.get(pk=idredacao)            ...       original_photo = stringio.stringio(obj.arquivo.read())     rotated_photo = stringio.stringio()      image = image.open(original_photo)     image = image.rotate(90)     image.save(rotated_photo, 'jpeg')      path = obj.arquivo._get_path()     obj.arquivo.delete()     obj.arquivo.save(path , contentfile(rotated_photo.getvalue()))     obj.save()      return render(request, 'thesamepagefromrequest.html',{"obj":obj,...}) 

any idea of how solve problem?

sorry bad english. appreciate help.