在 Heroku 上调试 Paperclip

发布于 2024-10-14 18:45:39 字数 278 浏览 3 评论 0原文

我正在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

堇色安年 2024-10-21 18:45:39

Heroku 日志并不总是有帮助。

出于您的目的,因为您刚刚开始,我建议您将 heroku 应用程序设置为“开发”模式,以便您可以看到详细的错误消息。

heroku config # Should return a list of your current environment, including RACK_ENV=production
heroku config:add RACK_ENV=development # now you'll get verbose error messages
heroku config:add RACK_ENV=production # set this back when you're done debugging

那应该有帮助!与我们分享错误消息,也许我们可以提供更多帮助。

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.

heroku config # Should return a list of your current environment, including RACK_ENV=production
heroku config:add RACK_ENV=development # now you'll get verbose error messages
heroku config:add RACK_ENV=production # set this back when you're done debugging

That should help! Share the error message with us and maybe we can help more.

听不够的曲调 2024-10-21 18:45:39

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.

尘曦 2024-10-21 18:45:39

您可以在命令行上运行 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文