我正在heroku上部署django项目,它工作正常,但是在django admin中,当我尝试上传图像时出现错误:
OSError at /admin/blocks/block/add/
[Errno 30] Read-only file system: '/home/goldwedd'
最佳答案
这是设计使然。
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
如果您想上传文件,则需要在 S3 或 django-storages 支持的任何其他存储后端上执行此操作。 .
关于django - Heroku django项目只读文件系统,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17716055/