1đź‘Ť
âś…
“problematic” code indeed – whoever wrote this should find another job. This code is wrong in more than one way (using MEDIA_URL instead of MEDIA_ROOT – which is the cause of the IOError you get – and also badly misusing Python’s dead simple file objects) and totally useless, and looks like a leftover of someone programming by accident. To make a long story short : just remove it and you’ll be fine.
Source:stackexchange.com