Django 保存大文件

Django save large files

我正在创建一个用户可以上传大文件的网站。大约 100-300Mb。我正在使用 django,但我想知道什么是保存文件的最佳选择。我应该将它们添加到我的用户数据库吗?或者我应该创建一个媒体文件夹并将文件保存在那里。如果是这样,那么这是否意味着我必须将文件名保存在我的用户数据库中?

请告诉我您将如何解决这个问题。

django 不将文件存储在数据库中,而是存储在媒体文件夹中。 FileField 包含文件的路径(在媒体文件夹中)。你可以change that behavior but it is not recommended(as general practice). What you should consider however is that files of that size will require some more work both in django and the front-end since the upload process will freeze the server. A potential solution to the problem is this: https://pypi.org/project/django-chunked-upload/