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

标签 ruby-on-rails ruby hosting shared-hosting

我被推荐使用 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/

相关文章:

ruby-on-rails - 在开发环境中安装了不同的 rails 和 gems 版本

ruby-on-rails - 按字段可用性对对象排序

类名中的 Ruby 插值

ruby-on-rails - 我可以在Rails应用程序的管理服务器上运行Elastic Server吗

node.js - Nodejs 网站托管,不是基于 Express ? :)

ruby-on-rails - 如何最好地在 ruby​​onrails 中创建递归目录列表的 xml 映射?

javascript - 将图标添加到 js.erb.html 中的 link_to?

c++ - 混合 Ruby 和其他语言的最佳方式是什么? (尤其是 C++)

ruby - 在使用 Capistrano 部署之前标记发布

iis - 从 IIS 重定向到 tomcat?