草庐IT

ruby-on-rails - Michael Hartl 的 Ruby on Rails 教程第 2 章练习(demo_app): app works on Windows 8 localhost, 但在 Heroku 上不起作用

coder 2024-06-21 原文

我是网络开发的新手,我正在尝试通过 Michael Hartl's book Ruby on Rails Tutorial 学习 RoR .我的问题在第二章(demo_app,一个使用脚手架的类似微博)。

demo_app 在 localhost:3000 上完美运行,但是当我将它推送到 Heroku 时,它不起作用(索引和/users 或/microposts)并显示消息:

*"应用程序错误 应用程序发生错误,无法提供您的页面。请稍后重试。

如果您是应用程序所有者,请查看您的日志以了解详细信息。”*

这是 Heroku 的日志:

2013-07-18T23:45:15+00:00 heroku[slug-compiler]: Slug compilation started
2013-07-18T23:47:13.079550+00:00 heroku[api]: Scale to web=1 by sergio.schuler@gmail.com
2013-07-18T23:47:14.164452+00:00 heroku[api]: Attach HEROKU_POSTGRESQL_COBALT resource by sergio.schuler@gmail.com
2013-07-18T23:47:14.198422+00:00 heroku[api]: Release v3 created by sergio.schuler@gmail.com
2013-07-18T23:47:14.289007+00:00 heroku[api]: Add DATABASE_URL config by sergio.schuler@gmail.com
2013-07-18T23:47:14.315343+00:00 heroku[api]: Release v4 created by sergio.schuler@gmail.com
2013-07-18T23:47:14.368054+00:00 heroku[api]: Deploy 5c359d1 by sergio.schuler@gmail.com
2013-07-18T23:47:14.404636+00:00 heroku[api]: Release v5 created by sergio.schuler@gmail.com
2013-07-18T23:47:14.455717+00:00 heroku[api]: Deploy 5c359d1 by sergio.schuler@gmail.com
2013-07-18T23:47:15+00:00 heroku[slug-compiler]: Slug compilation finished
2013-07-18T23:47:24.815578+00:00 heroku[web.1]: State changed from starting to crashed
2013-07-18T23:47:24.816243+00:00 heroku[web.1]: State changed from crashed to starting
2013-07-18T23:47:29.239184+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 40177 -e $RAILS_ENV`
2013-07-18T23:47:30.141486+00:00 app[web.1]: bash: bin/rails: No such file or directory
2013-07-18T23:47:32.030497+00:00 heroku[web.1]: Process exited with status 127
2013-07-18T23:47:32.047706+00:00 heroku[web.1]: State changed from starting to crashed
2013-07-18T23:47:33.081140+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=powerful-hamlet-1820.herokuapp.com fwd="200.102.212.90" dyno= connect= service= status=503 bytes=
2013-07-18T23:47:33.459600+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=powerful-hamlet-1820.herokuapp.com fwd="200.102.212.90" dyno= connect= service= status=503 bytes=
2013-07-18T23:47:39.437747+00:00 heroku[web.1]: Error R99 (Platform error) -> Failed to launch the dyno within 10 seconds
2013-07-18T23:47:39.437747+00:00 heroku[web.1]: Stopping process with SIGKILL
2013-07-18T23:48:39.904762+00:00 heroku[api]: Starting process with command `bundle exec rake db:migrate` by sergio.schuler@gmail.com
2013-07-18T23:48:43.962916+00:00 heroku[run.7255]: Awaiting client
2013-07-18T23:48:44.045577+00:00 heroku[run.7255]: Starting process with command `bundle exec rake db:migrate`
2013-07-18T23:48:45.332120+00:00 heroku[run.7255]: State changed from starting to up
2013-07-18T23:48:49.566475+00:00 heroku[run.7255]: Process exited with status 0
2013-07-18T23:48:49.575731+00:00 heroku[run.7255]: State changed from up to complete
2013-07-18T23:49:12.500850+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=powerful-hamlet-1820.herokuapp.com fwd="
200.102.212.90" dyno= connect= service= status=503 bytes=
2013-07-18T23:49:16.494827+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=powerful-hamlet-1820.herokuapp.com fwd="
200.102.212.90" dyno= connect= service= status=503 bytes=
2013-07-18T23:49:18.188864+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/users host=powerful-hamlet-1820.herokuapp.com fwd="200.102.212.90" dyno= connect= service= status=503 bytes=
2013-07-18T23:49:18.523155+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=powerful-hamlet-1820.herokuapp.com fwd="
200.102.212.90" dyno= connect= service= status=503 bytes=
2013-07-18T23:49:20.389909+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/users host=powerful-hamlet-1820.herokuapp.com fwd="200.102.212.90" dyno= connect= service= status=503 bytes=
2013-07-18T23:49:20.706606+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=powerful-hamlet-1820.herokuapp.com fwd="
200.102.212.90" dyno= connect= service= status=503 bytes=
2013-07-18T23:49:19.925876+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=powerful-hamlet-1820.herokuapp.com fwd="200.102.212.90" dyno= connect= service= status=503 bytes=
2013-07-18T23:49:21.662834+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/users host=powerful-hamlet-1820.herokuapp.com fwd="200.102.212.90" dyno= connect= service= status=503 bytes=
2013-07-18T23:49:21.973127+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=powerful-hamlet-1820.herokuapp.com fwd="200.102.212.90" dyno= connect= service= status=503 bytes=
2013-07-18T23:58:04.507344+00:00 heroku[web.1]: State changed from crashed to starting
2013-07-18T23:58:07.786500+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 32660 -e $RAILS_ENV`
2013-07-18T23:58:08.981452+00:00 app[web.1]: bash: bin/rails: No such file or directory
2013-07-18T23:58:10.252381+00:00 heroku[web.1]: Process exited with status 127
2013-07-18T23:58:10.273793+00:00 heroku[web.1]: State changed from starting to crashed
2013-07-19T00:08:40.833356+00:00 heroku[web.1]: State changed from crashed to starting
2013-07-19T00:08:44.112189+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 21751 -e $RAILS_ENV`
2013-07-19T00:08:46.119816+00:00 app[web.1]: bash: bin/rails: No such file or directory
2013-07-19T00:08:47.198086+00:00 heroku[web.1]: State changed from starting to crashed
2013-07-19T00:08:47.181492+00:00 heroku[web.1]: Process exited with status 127
2013-07-19T00:19:17.976344+00:00 heroku[web.1]: State changed from crashed to starting
2013-07-19T00:19:21.334982+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 35103 -e $RAILS_ENV`
2013-07-19T00:19:21.887922+00:00 app[web.1]: bash: bin/rails: No such file or directory
2013-07-19T00:19:22.932515+00:00 heroku[web.1]: Process exited with status 127
2013-07-19T00:19:31.846924+00:00 heroku[web.1]: Error R99 (Platform error) -> Failed to launch the dyno within 10 seconds
2013-07-19T00:19:31.847214+00:00 heroku[web.1]: Stopping process with SIGKILL

这是存储库:https://github.com/sergioschuler/demo_app

我也试过这个:

bundle exec rake assets:precompile
git add .
git commit -am "add a note reflecting changes made"
git push
heroku create
git push heroku master
heroku rake db:migrate
heroku db:push

(最终我连我的本地应用程序都亏本了,所以我回滚了)

我正在使用 Windows 8 并安装了 Railsinstaller。

抱歉,如果缺少某些信息,我对这一切还是有点陌生​​。

最佳答案

错误在这里:

2013-07-18T23:47:29.239184+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 40177 -e $RAILS_ENV`
2013-07-18T23:47:30.141486+00:00 app[web.1]: bash: bin/rails: No such file or directory

尝试添加 Procfile你的应用程序有这个:

web: bundle exec rails server -p $PORT

关于ruby-on-rails - Michael Hartl 的 Ruby on Rails 教程第 2 章练习(demo_app): app works on Windows 8 localhost, 但在 Heroku 上不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17736328/

有关ruby-on-rails - Michael Hartl 的 Ruby on Rails 教程第 2 章练习(demo_app): app works on Windows 8 localhost, 但在 Heroku 上不起作用的更多相关文章

  1. ruby-on-rails - 使用 Ruby on Rails 进行自动化测试 - 最佳实践 - 2

    很好奇,就使用ruby​​onrails自动化单元测试而言,你们正在做什么?您是否创建了一个脚本来在cron中运行rake作业并将结果邮寄给您?git中的预提交Hook?只是手动调用?我完全理解测试,但想知道在错误发生之前捕获错误的最佳实践是什么。让我们理所当然地认为测试本身是完美无缺的,并且可以正常工作。下一步是什么以确保他们在正确的时间将可能有害的结果传达给您? 最佳答案 不确定您到底想听什么,但是有几个级别的自动代码库控制:在处理某项功能时,您可以使用类似autotest的内容获得关于哪些有效,哪些无效的即时反馈。要确保您的提

  2. ruby-on-rails - rails : keeping DRY with ActiveRecord models that share similar complex attributes - 2

    这似乎应该有一个直截了当的答案,但在Google上花了很多时间,所以我找不到它。这可能是缺少正确关键字的情况。在我的RoR应用程序中,我有几个模型共享一种特定类型的字符串属性,该属性具有特殊验证和其他功能。我能想到的最接近的类似示例是表示URL的字符串。这会导致模型中出现大量重复(甚至单元测试中会出现更多重复),但我不确定如何让它更DRY。我能想到几个可能的方向...按照“validates_url_format_of”插件,但这只会让验证干给这个特殊的字符串它自己的模型,但这看起来很像重溶液为这个特殊的字符串创建一个ruby​​类,但是我如何得到ActiveRecord关联这个类模型

  3. ruby-on-rails - 在 Rails 中将文件大小字符串转换为等效千字节 - 2

    我的目标是转换表单输入,例如“100兆字节”或“1GB”,并将其转换为我可以存储在数据库中的文件大小(以千字节为单位)。目前,我有这个:defquota_convert@regex=/([0-9]+)(.*)s/@sizes=%w{kilobytemegabytegigabyte}m=self.quota.match(@regex)if@sizes.include?m[2]eval("self.quota=#{m[1]}.#{m[2]}")endend这有效,但前提是输入是倍数(“gigabytes”,而不是“gigabyte”)并且由于使用了eval看起来疯狂不安全。所以,功能正常,

  4. ruby-on-rails - Ruby net/ldap 模块中的内存泄漏 - 2

    作为我的Rails应用程序的一部分,我编写了一个小导入程序,它从我们的LDAP系统中吸取数据并将其塞入一个用户表中。不幸的是,与LDAP相关的代码在遍历我们的32K用户时泄漏了大量内存,我一直无法弄清楚如何解决这个问题。这个问题似乎在某种程度上与LDAP库有关,因为当我删除对LDAP内容的调用时,内存使用情况会很好地稳定下来。此外,不断增加的对象是Net::BER::BerIdentifiedString和Net::BER::BerIdentifiedArray,它们都是LDAP库的一部分。当我运行导入时,内存使用量最终达到超过1GB的峰值。如果问题存在,我需要找到一些方法来更正我的代

  5. ruby-on-rails - unicode 字符串的长度 - 2

    在我的Rails(2.3,Ruby1.8.7)应用程序中,我需要将字符串截断到一定长度。该字符串是unicode,在控制台中运行测试时,例如'א'.length,我意识到返回了双倍长度。我想要一个与编码无关的长度,以便对unicode字符串或latin1编码字符串进行相同的截断。我已经了解了Ruby的大部分unicode资料,但仍然有些一头雾水。应该如何解决这个问题? 最佳答案 Rails有一个返回多字节字符的mb_chars方法。试试unicode_string.mb_chars.slice(0,50)

  6. ruby-on-rails - Ruby on Rails 迁移,将表更改为 MyISAM - 2

    如何正确创建Rails迁移,以便将表更改为MySQL中的MyISAM?目前是InnoDB。运行原始执行语句会更改表,但它不会更新db/schema.rb,因此当在测试环境中重新创建表时,它会返回到InnoDB并且我的全文搜索失败。我如何着手更改/添加迁移,以便将现有表修改为MyISAM并更新schema.rb,以便我的数据库和相应的测试数据库得到相应更新? 最佳答案 我没有找到执行此操作的好方法。您可以像有人建议的那样更改您的schema.rb,然后运行:rakedb:schema:load,但是,这将覆盖您的数据。我的做法是(假设

  7. ruby-on-rails - rails : "missing partial" when calling 'render' in RSpec test - 2

    我正在尝试测试是否存在表单。我是Rails新手。我的new.html.erb_spec.rb文件的内容是:require'spec_helper'describe"messages/new.html.erb"doit"shouldrendertheform"dorender'/messages/new.html.erb'reponse.shouldhave_form_putting_to(@message)with_submit_buttonendendView本身,new.html.erb,有代码:当我运行rspec时,它失败了:1)messages/new.html.erbshou

  8. ruby-on-rails - 由于 "wkhtmltopdf",PDFKIT 显然无法正常工作 - 2

    我在从html页面生成PDF时遇到问题。我正在使用PDFkit。在安装它的过程中,我注意到我需要wkhtmltopdf。所以我也安装了它。我做了PDFkit的文档所说的一切......现在我在尝试加载PDF时遇到了这个错误。这里是错误:commandfailed:"/usr/local/bin/wkhtmltopdf""--margin-right""0.75in""--page-size""Letter""--margin-top""0.75in""--margin-bottom""0.75in""--encoding""UTF-8""--margin-left""0.75in""-

  9. ruby-on-rails - Rails 3 中的多个路由文件 - 2

    Rails2.3可以选择随时使用RouteSet#add_configuration_file添加更多路由。是否可以在Rails3项目中做同样的事情? 最佳答案 在config/application.rb中:config.paths.config.routes在Rails3.2(也可能是Rails3.1)中,使用:config.paths["config/routes"] 关于ruby-on-rails-Rails3中的多个路由文件,我们在StackOverflow上找到一个类似的问题

  10. ruby-on-rails - 如何验证 update_all 是否实际在 Rails 中更新 - 2

    给定这段代码defcreate@upgrades=User.update_all(["role=?","upgraded"],:id=>params[:upgrade])redirect_toadmin_upgrades_path,:notice=>"Successfullyupgradeduser."end我如何在该操作中实际验证它们是否已保存或未重定向到适当的页面和消息? 最佳答案 在Rails3中,update_all不返回任何有意义的信息,除了已更新的记录数(这可能取决于您的DBMS是否返回该信息)。http://ar.ru

随机推荐