ag是否有文件大小限制或扩展名限制? [英] Is there a file size limit or extension limit in wagtail?

查看:62
本文介绍了ag是否有文件大小限制或扩展名限制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个非常简单的模型(产品),该模型在页面中用作InlinePanel.

I have a very simple model (Product) which is used as an InlinePanel in a page.

产品具有一个FileField,只要我上传小文件,它就可以正常工作,但是一旦我上传大文件(> 5MB),我就会以某种方式收到CSRF错误.无论是在本地还是在生产上.

Product has a FileField which works fine as long as I upload small files, but as soon as I upload a large file (>5MB), I somehow get an CSRF error. Both on local and on production.

nginx最大上传大小不是问题.

It is not an issue with nginx max upload size.

w是否有文件大小限制或扩展名限制?

Is there a file size limit or extension limit in wagtail?

推荐答案

是的,这变成了w.如果将以下设置添加到settings.py(或任何主要设置文件)中,则可以限制上传大小.

Yes, this comes baked into wagtail. If you add the following setting to your settings.py (or whatever your main settings file is), you'll be able to restrict upload sizes.

WAGTAILIMAGES_MAX_UPLOAD_SIZE = 15 * 1024 * 1024   # 15mb

文档也简要介绍了这一点.这是链接: http://docs.wagtail.io/en/v2.1.1/advanced_topics/settings.html#maximum-upload-size-for-images

The docs briefly cover this, too. Here's the link: http://docs.wagtail.io/en/v2.1.1/advanced_topics/settings.html#maximum-upload-size-for-images

如果您需要将文件大小从15mb更改为其他大小,只需将设置行中的 15 更改为您要限制的mb数即可.

If you need to change the file size from 15mb to anything else, just change that 15 in the settings line to the number of mb you want to limit it to.

这篇关于ag是否有文件大小限制或扩展名限制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆