优化zip文集导入的处理

This commit is contained in:
zmister 2021-09-23 11:28:43 +08:00
parent 630a8ef261
commit d9c1892a4e

View File

@ -49,7 +49,7 @@ def import_project(request):
if file_name.endswith('.zip'):
if os.path.exists(os.path.join(settings.MEDIA_ROOT,'import_temp')) is False:
os.mkdir(os.path.join(settings.MEDIA_ROOT,'import_temp'))
temp_file_name = str(time.time())+'.zip'
temp_file_name = datetime.datetime.now().strftime('%Y%m%d%H%M%S%f') +'.zip'
temp_file_path = os.path.join(settings.MEDIA_ROOT,'import_temp/'+temp_file_name)
with open(temp_file_path,'wb+') as zip_file:
for chunk in import_file: