遇到在Heroku上创建文件的问题(Rails) [英] Running into problems with creating a file on Heroku (Rails)

查看:103
本文介绍了遇到在Heroku上创建文件的问题(Rails)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我有一个用户模型,并且在用户注册时,我需要生成一个包含特定用户信息的文件。 Heroku不允许我这样做。除了生成文件并将其写入S3存储桶并从中引用它之外,还有其他选项吗? 解决方案

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屋!

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