import uuid
import os
import re
import copy
from collections import defaultdict
from django.utils.timezone import now
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework.status import HTTP_200_OK, HTTP_403_FORBIDDEN
from file_sys.settings import BASE_DIR
from django.http import StreamingHttpResponse, HttpResponse
from django.utils.encoding import escape_uri_path
from io import BytesIO
import zipfile
# Create your views here.
class Upload(APIView):
authentication_classes = ()
permission_classes = ()
def post(self, request):
path_category = request.data.get('path', 'default')
path_date = now().strftime('%Y-%m-%d')
file_list = request.FILES.getlist('files')
response_data = {
'code': HTTP_403_FORBIDDEN,
'message': '',
'data': defaultdict()
}
file_relative_path_list = []
if file_list:
python django rest文件上传、删除、下载api
最新推荐文章于 2022-08-24 19:15:00 发布
本文介绍了如何使用Python的Django REST框架实现文件上传、删除和下载功能。通过创建API接口,详细阐述了相关视图、序列化器和URL配置的实现步骤,为开发者提供了一个完整的Django REST文件操作指南。

最低0.47元/天 解锁文章
1709

被折叠的 条评论
为什么被折叠?



