简体   繁体   English

如何更改文件上传大小限制 Django Summernote

[英]How to Change File Upload Size Limit Django Summernote

I'm using Django-summernote.我正在使用 Django-summernote。 I have installed it by pip install django-summernote command.我已经通过 pip install django-summernote 命令安装了它。 How can I change the file size upload limit?如何更改文件大小上传限制? I get the error: "File size exceeds the limit allowed and cannot be saved" when I try to add an image using the summernote widget's toolbar.当我尝试使用 summernote 小部件的工具栏添加图像时,出现错误:“文件大小超出允许的限制,无法保存”。

I have solved this problem by the following steps:我已经通过以下步骤解决了这个问题:

In--> settings.py, globally declare max_image_pixel:在-->settings.py中,全局声明max_image_pixel:

MAX_IMAGE_PIXELS = int(1024 * 1024 * 1024 // 4 // 3)

Then in the same --> settings.py, do the following:然后在同一个 --> settings.py 中,执行以下操作:

SUMMERNOTE_CONFIG = {
  ...
 'attachment_filesize_limit': MAX_IMAGE_PIXELS,
  }

Reference 参考

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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