简体   繁体   中英

Django models FileField large file upload

I need to upload large files(approximately 1GB) while using FileField field in Django model. This gives the error DATA_UPLOAD_MAX_MEMORY_SIZE. I think I need to use chunked-upload while saving in the model. How can I do that? Or is there any other solution?

RequestDataTooBig at /admin/supports/software/add/
Request body exceeded settings.DATA_UPLOAD_MAX_MEMORY_SIZE.
Request Method: POST
Request URL:    http://0.0.0.0:8000/admin/supports/software/add/
Django Version: 3.0.5
Exception Type: RequestDataTooBig
Exception Value:    
Request body exceeded settings.DATA_UPLOAD_MAX_MEMORY_SIZE.
Exception Location: /usr/local/lib/python3.8/site-packages/django/http/request.py in body, line 297
Python Executable:  /usr/local/bin/python
Python Version: 3.8.3
Python Path:    
['/app',
 '/app',
 '/usr/local/lib/python38.zip',
 '/usr/local/lib/python3.8',
 '/usr/local/lib/python3.8/lib-dynload',
 '/usr/local/lib/python3.8/site-packages']
Server time:    Prş, 26 Ağu 2021 15:24:51 +0300

my model:

class Software(AbstractBasicFTPSupportModel):
category = models.ForeignKey(
    to="SupportCategory", related_name="softwares", on_delete=models.CASCADE, verbose_name=_("category"),
)
related_products = models.ManyToManyField(
    "product.Product", blank=True, related_name="softwares", verbose_name=_("related products")
)
software_file = models.FileField(
    upload_to=save_support_file, verbose_name=_("software file"), null=True, blank=True, max_length=255,
)

set FILE_UPLOAD_MAX_MEMORY_SIZE in settings.py

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM