I want to download one directory from my server on button click. The directory should be downloaded in zip format. I am using Django and Python. I tried this earlier with the same code but it was on Python2 venv. The same code on Python3 venv gives utf-8 codec can't decode byte error. The zip of the directory is created successfully but when i press the download button on my website it throws me above error.
@login_required
def logs_folder_index(request):
    user = request.user
    if not is_moderator(user):
        raise Http404("You are not allowed to see this page.")
    else:
        if os.path.exists('Experiments.zip'):
            os.remove('Experiments.zip')
        zipf = zipfile.ZipFile('Experiments.zip','w',zipfile.ZIP_DEFLATED)
        path = settings.BASE_DIR + '/experiments/'
        zipdir(path,zipf)
        zipf.close()
        zip_file = open('Experiments.zip','r')
        response = HttpResponse(zip_file, 
                content_type='application/force-download')
        response['Content-Disposition'] = 'attachment; filename="{0}"'\
                                        .format(Experiments.zip)
        return response
Can someone please help me with this problem.
 
    