Storing file content in DB

前端 未结 4 990
温柔的废话
温柔的废话 2021-02-14 04:08

I am making a model in which i have a FileField. I want to store the file content in a database column, instead of file path. Any suggestions?

4条回答
  •  眼角桃花
    2021-02-14 04:52

    I know this is an old question, but there's been some good code written since then to allow this option. Specially, see django-database-files, which will use Django's storage API to make all FileFields and ImageFields store their contents in the database. There's also a fork to cache the files locally on the filesystem, to overcome the biggest caveat of using the database, which is latency.

提交回复
热议问题