gpt4 book ai didi

ruby-on-rails - Heroku,问题/问题

转载 作者:数据小太阳 更新时间:2023-10-29 08:14:42 25 4
gpt4 key购买 nike

我被推荐使用 Heroku for Ruby on Rails 托管,到目前为止,我认为我真的会喜欢它。只是想知道是否有人可以帮助我找出问题所在。

我按照那里的说明在该网站上创建应用程序,创建并提交 git,推送代码,它显示在 http://mylifebattlecry.heroku.com。 (尽管我所做的大部分工作都在/posts/路径中)当我进入一个新的“帖子”(因为这是一种博客平台)时,我收到 500.html 错误并且基本上一切都关闭了。甚至无法返回我输入帖子的页面。

在我看来,数据库设置有问题。我按照他们的建议做了,包括...$ heroku rake db:migrate,什么也没有。

只是想知道是否有人立即知道我做错了什么。以下是他们提供的说明以供引用:

安装 Heroku gem:sudo gem install heroku为您的应用创建一个新的 git 存储库(如果您还没有):

cd myapp
git init && git add . && git commit -m "first commit"

创建一个新的 Heroku 应用:

heroku create
Created http://sharp-autumn-42.com/ | git@heroku.com:sharp-autumn-42.git
Git remote heroku added

注意:应用程序的名称是自动生成的;别担心,您可以随时重命名它。

部署您的代码:

git push heroku master

运行迁移(或其他引导任务):

heroku rake db:migrate

在浏览器中打开已部署的应用程序: heroku 打开

如果有帮助,这里是 ..$ heroku 日志:

brandon-gadocis-macbook-pro:mylifebattlecry bgadoci$ heroku logs -app mylifebattlecry
==> dyno-629271.log <==

==> production.log <==
# Logfile created on Sun Nov 22 18:26:06 -0800 2009

Processing PostsController#index (for 99.7.50.140 at 2009-11-22 18:26:07) [GET]
Rendering template within layouts/posts
Rendering posts/index

ActionView::TemplateError (PGError: ERROR: column votes.post_id does not exist
LINE 1: SELECT count(*) AS count_all FROM "votes" WHERE ("votes".pos...
^
: SELECT count(*) AS count_all FROM "votes" WHERE ("votes".post_id = 1) ) on line #58 of app/views/posts/index.html.erb:
55: </div>
56: <div id="vote"><br/>
57: <div id="votes">
58: <%= pluralize post.votes.count, 'Person' %> like the above BattleCry. <br/>
59: </div>
60: <%= link_to "Comments (#{post.comments.count})", post %>
61: </div>

app/views/posts/index.html.erb:58
app/views/posts/index.html.erb:51
app/views/posts/index.html.erb:45:in `each'
app/views/posts/index.html.erb:45
app/controllers/posts_controller.rb:11:in `index'
/home/heroku_rack/lib/static_assets.rb:9:in `call'
/home/heroku_rack/lib/last_access.rb:25:in `call'
/home/heroku_rack/lib/date_header.rb:14:in `call'
thin (1.0.1) lib/thin/connection.rb:80:in `pre_process'
thin (1.0.1) lib/thin/connection.rb:78:in `catch'
thin (1.0.1) lib/thin/connection.rb:78:in `pre_process'
thin (1.0.1) lib/thin/connection.rb:57:in `process'
thin (1.0.1) lib/thin/connection.rb:42:in `receive_data'
eventmachine (0.12.6) lib/eventmachine.rb:240:in `run_machine'
eventmachine (0.12.6) lib/eventmachine.rb:240:in `run'
thin (1.0.1) lib/thin/backends/base.rb:57:in `start'
thin (1.0.1) lib/thin/server.rb:150:in `start'
thin (1.0.1) lib/thin/controllers/controller.rb:80:in `start'
thin (1.0.1) lib/thin/runner.rb:173:in `send'
thin (1.0.1) lib/thin/runner.rb:173:in `run_command'
thin (1.0.1) lib/thin/runner.rb:139:in `run!'
thin (1.0.1) bin/thin:6
/usr/local/bin/thin:20:in `load'
/usr/local/bin/thin:20

Rendering /disk1/home/slugs/88382_601a216_9803/mnt/public/500.html (500 Internal Server Error)

最佳答案

您确定所有表都有迁移吗?

你可以做 heroku rake db:schema:load 来加载一个新的模式

关于ruby-on-rails - Heroku,问题/问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1780789/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com