Heroku django项目只读文件系统 [英] Heroku django project read-only file system
问题描述
我在heroku上部署django项目,它工作正常,但在Django管理员,当我试图上传图像我得到错误: >
在/ admin / blocks / block / add /
$ b [Errno 30]中的OSError只读文件系统:'/ home / goldwedd'
$ c
$ b>
您的应用程序被编译成一个由dyno manager进行快速分发的slug。 slug的文件系统是只读的,这意味着你不能动态地写入文件系统进行半永久存储。 不支持以下类型的行为:
- 在公共目录中缓存页面
- 将上传的资源保存到本地磁盘(例如使用attachment_fu或回形针)
使用Ferret编写全文索引
- 写入文件系统数据库(如SQLite或GDBM)
- 访问git-wiki等应用程序的git repo
https:// devcenter .heroku.com / articles /只读文件系统
如果你想上传文件,你需要这样做到S3或任何其他存储后端由 django-storages 支持。
I'm deploying django project on heroku, it works fine, but in django admin, when i'm trying to upload image i got error:
OSError at /admin/blocks/block/add/ [Errno 30] Read-only file system: '/home/goldwedd'
解决方案This is by design.
Your app is compiled into a slug for fast distribution by the dyno manager. The filesystem for the slug is read-only, which means you cannot dynamically write to the filesystem for semi-permanent storage. The following types of behaviors are not supported:
- Caching pages in the public directory
- Saving uploaded assets to local disk (e.g. with attachment_fu or paperclip)
- Writing full-text indexes with Ferret
- Writing to a filesystem database like SQLite or GDBM
- Accessing a git repo for an app like git-wiki
https://devcenter.heroku.com/articles/read-only-filesystem
If you want to upload files, you need to do so to S3 or any of the other storage backends supported by django-storages.
这篇关于Heroku django项目只读文件系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!