zoukankan      html  css  js  c++  java
  • Django上传文件的那些参数

    # ################## 默认文件上传配置 ########################
    from django.core.files.uploadhandler import MemoryFileUploadHandler
    from django.core.files.uploadhandler import TemporaryFileUploadHandler
    
    # List of upload handler classes to be applied in order.
    FILE_UPLOAD_HANDLERS = [
        'django.core.files.uploadhandler.MemoryFileUploadHandler',
        'django.core.files.uploadhandler.TemporaryFileUploadHandler',
    ]
    
    # Maximum size, in bytes, of a request before it will be streamed to the
    # file system instead of into memory.
    # 允许内存中上传文件的大小
    #   合法:InMemoryUploadedFile对象(写在内存)         -> 上传文件小于等于 FILE_UPLOAD_MAX_MEMORY_SIZE
    # 不合法:TemporaryUploadedFile对象(写在临时文件)     -> 上传文件大于    FILE_UPLOAD_MAX_MEMORY_SIZE 且 小于 DATA_UPLOAD_MAX_MEMORY_SIZE
    
    FILE_UPLOAD_MAX_MEMORY_SIZE = 2621440  # i.e. 2.5 MB
    
    # Maximum size in bytes of request data (excluding file uploads) that will be
    # read before a SuspiciousOperation (RequestDataTooBig) is raised.
    # 允许上传内容的大小(包含文件和其他请求内容)
    DATA_UPLOAD_MAX_MEMORY_SIZE = 2621440  # i.e. 2.5 MB
    
    # Maximum number of GET/POST parameters that will be read before a
    # SuspiciousOperation (TooManyFieldsSent) is raised.
    # 允许的上传文件数
    DATA_UPLOAD_MAX_NUMBER_FIELDS = 1000
    
    # Directory in which upload streamed files will be temporarily saved. A value of
    # `None` will make Django use the operating system's default temporary directory
    # (i.e. "/tmp" on *nix systems).
    # 临时文件夹路径
    FILE_UPLOAD_TEMP_DIR = None
    
    # The numeric mode to set newly-uploaded files to. The value should be a mode
    # you'd pass directly to os.chmod; see https://docs.python.org/3/library/os.html#files-and-directories.
    # 文件权限
    FILE_UPLOAD_PERMISSIONS = None
    
    # The numeric mode to assign to newly-created directories, when uploading files.
    # The value should be a mode as you'd pass to os.chmod;
    # see https://docs.python.org/3/library/os.html#files-and-directories.
    # 文件夹权限
    FILE_UPLOAD_DIRECTORY_PERMISSIONS = None
    清风深知杨柳意,啤酒龙虾难相聚。
  • 相关阅读:
    一天搞懂深度学习--深度学习简介
    Ubuntu16.04下安装Hive
    Ubuntu16.04下安装Hadoop
    Hive入门学习--HIve简介
    循环神经网络(RNN)--学习笔记
    如何使用GitHub
    python pandas import 失败
    Azure ARM VM内部关机了,但门户却显示虚拟机还在处在“正在运行”的状态
    Exchange 2010 与 RMS(集成权限管理服务)集成
    统计 Exchange 2010 时间段收发邮件总量
  • 原文地址:https://www.cnblogs.com/zhigu/p/10028799.html
Copyright © 2011-2022 走看看