Commit 9af1ed36 authored by Ilya Simonov's avatar Ilya Simonov

fix upload local file

parent 4ffdd452
...@@ -4,7 +4,6 @@ import logging ...@@ -4,7 +4,6 @@ import logging
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from moviepy.editor import VideoFileClip from moviepy.editor import VideoFileClip
from wsgiref.util import FileWrapper
from .models import Video, Playlist, TagToObject, DYNAMIC, PlaylistVideo from .models import Video, Playlist, TagToObject, DYNAMIC, PlaylistVideo
...@@ -28,10 +27,7 @@ def download_file(url): ...@@ -28,10 +27,7 @@ def download_file(url):
def handle_uploaded_file(f, file_name): def handle_uploaded_file(f, file_name):
chunk_count = 0 chunk_count = 0
with open(file_name, 'wb+') as destination: with open(file_name, 'wb+') as destination:
wrapper = FileWrapper(f, blksize=5000) for chunk in f.chunks():
# for chunk in f.chunks():
for chunk in wrapper:
destination.write(chunk) destination.write(chunk)
chunk_count += 1 chunk_count += 1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment