遇到在Heroku上创建文件的问题(Rails) [英] Running into problems with creating a file on Heroku (Rails)
问题描述
Heroku的文件系统是只读的。唯一的例外是tmp目录,但那是暂时的。
S3是一种常用的解决方案。另一种可能是将文件保存到数据库中(在迁移中使用文本列)。你也可以使用一些文件存储,如CouchDB或MongoDB,并在那里存储你的文件。 Couch和Mongo有几款Heroku附加软件甚至提供免费套餐。
So I have a user model and upon a user's registration I need to generate a file with some specific user information in it. Heroku is not allowing me to do that. Is there any other option besides generating the file and writing it to an S3 bucket and referencing it from there.
Heroku's file system is read-only. The only exception is the tmp dir, but that's, well, temporary. S3 is a common solution. Another possibility is saving that "file" to the database (use a "text" column in your migration). You could also use some document store, such as CouchDB or MongoDB and store your "file" there. There are several Heroku add-ons for Couch and Mongo that even offer a free tier.
这篇关于遇到在Heroku上创建文件的问题(Rails)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!