在 Heroku 上调试 Paperclip
我正在 Heroku 上构建我的第一个应用程序,并同时学习如何使用 Rails。我构建了一个非常简单的模型,并在我的构建中添加了“回形针”宝石。它可以在我的本地主机上运行(尽管它似乎没有上传文件),但是当部署在 Heroku 上时,在“新”表单上我只得到:
很抱歉,出了点问题。
我们已收到有关此问题的通知 我们很快就会看一下。
我似乎不知道从哪里开始调试这个。我的 Gemfile 包含 gem 'paperclip' 行
I am building my first app on Heroku and learning how to use rails simultaneously. I have built a very simple Model, and added a 'Paperclip' gem to my build. It works on my localhost (although it doesn't seem to upload files), however when deployed on Heroku, on the 'new' form I just get:
We're sorry, but something went wrong.
We've been notified about this issue
and we'll take a look at it shortly.
I can't seem to figure out where to begin debugging this. My Gemfile contains the line gem 'paperclip'
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Heroku 日志并不总是有帮助。
出于您的目的,因为您刚刚开始,我建议您将 heroku 应用程序设置为“开发”模式,以便您可以看到详细的错误消息。
那应该有帮助!与我们分享错误消息,也许我们可以提供更多帮助。
Heroku logs doesn't always help.
For your purposes since you're just getting started I would recommend setting your heroku app to "development" mode so you can see verbose error messages.
That should help! Share the error message with us and maybe we can help more.
Heroku 有一个只读文件系统。这意味着 Paperclip 无法将上传的文件保存到 Heroku 中的任何位置。
如果您希望能够将文件上传到 Heroku 上托管的应用程序,那么您必须将文件作为二进制 blob 存储在数据库中,或者必须使用单独的服务来存储文件。如果您正在寻找单独的服务,Paperclip 具有与 Amazon S3 集成的内置支持。
请参阅相关的 Heroku 文档。
Heroku has a read-only filesystem. That means Paperclip cannot save uploaded files to any place within Heroku.
If you would like to be able to upload files to an application hosted on Heroku, then you must either store the files as binary blobs within your database or you must use a separate service to store the files. If you are looking for a separate service, Paperclip has built-in support for integrating with Amazon S3.
See the relevant Heroku docs.
您可以在命令行上运行
heroku log
来检索应用程序的日志文件。您肯定会在那里找到答案。
You can run
heroku logs
on the commandline to retrieve the log files of your application.Surely you will find your answer there.