From 6c9524c5f94845098d35205f6c79cc6c5843becb Mon Sep 17 00:00:00 2001 From: Andrey Date: Tue, 5 Dec 2017 13:20:08 +0300 Subject: [PATCH] create map --- lms/tools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lms/tools.py b/lms/tools.py index 8c258cd..32f0002 100644 --- a/lms/tools.py +++ b/lms/tools.py @@ -12,7 +12,7 @@ def decode_base64(my_str, upload_to=None): path = "%s/%s" % (settings.MEDIA_ROOT, upload_to) os.makedirs(os.path.dirname(path), exist_ok=True) url = "%s%s" % (settings.MEDIA_URL, upload_to) - with open(path, "w") as fh: + with open(path, "wb") as fh: fh.write(base64.b64decode(my_str)) return url return my_str