django 将图像存储在数据库中 [英] django store image in database

查看:26
本文介绍了django 将图像存储在数据库中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道是否有直接在数据库中存储图像的开箱即用方式与使用 ImageField 模型类型将其简单地上传到 MEDIA_ROOT.如果有,那么如何提供这些图像?

Does anyone know if there's an out-of-the box way of storing images directly in the database vs. using ImageField model type that simply uploads it to the MEDIA_ROOT. And if there is, how does one serve those images then?

干杯

推荐答案

不,没有.并且有充分的理由.从数据库存储和提供图像的效率非常低.将它们存储在文件系统中,并直接从 Apache 提供它们.

No, there isn't. And for good reason. It's horribly inefficient to store and serve images from the database. Store them on the filesystem, and serve them directly from Apache.

这篇关于django 将图像存储在数据库中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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