我知道这个问题已经被问了很多遍了,但是我已经尝试了很多解决方案,但是没有运气。我在Heroku上部署了一个Rails应用程序,该应用程序可在本地运行,但我收到“很抱歉,出了点问题。” 当我尝试在Heroku上启动它时。
我试过了
heroku run rake db:migrate heroku restart heroku open
但该表已存在于架构中
我试过了:
rake db:reset
并耙db:drop db:create db:migrate
我知道默认情况下,更改是在开发环境中完成的,这可能是原因吗?我正在运行开发环境中的更改,但是“ heroku open”会打开产品环境吗?
更新,heroku日志的完整摘要: heroku日志
2015-12-12T05:47:57.814680+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:32:in `start' 2015-12-12T05:47:57.814679+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:170:in `block in start' 2015-12-12T05:47:57.814682+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:264:in `start' 2015-12-12T05:47:57.814680+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:160:in `start' 2015-12-12T05:47:57.814683+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.6/lib/rails/commands/server.rb:69:in `start' 2015-12-12T05:47:57.814681+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:14:in `run' 2015-12-12T05:47:57.814684+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.6/lib/rails/commands/commands_tasks.rb:81:in `block in server' 2015-12-12T05:47:57.814685+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.6/lib/rails/commands/commands_tasks.rb:76:in `tap' 2015-12-12T05:47:57.814686+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.6/lib/rails/commands/commands_tasks.rb:76:in `server' 2015-12-12T05:47:57.814686+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.6/lib/rails/commands/commands_tasks.rb:40:in `run_command!' 2015-12-12T05:47:57.814687+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.6/lib/rails/commands.rb:17:in `' 2015-12-12T05:47:57.814688+00:00 app[web.1]: bin/rails:8:in `require' 2015-12-12T05:47:57.814688+00:00 app[web.1]: bin/rails:8:in ` ' 2015-12-12T05:47:57.814711+00:00 app[web.1]: [2015-12-12 05:47:57] INFO going to shutdown ... 2015-12-12T05:47:57.814800+00:00 app[web.1]: Exiting 2015-12-12T05:47:57.814767+00:00 app[web.1]: [2015-12-12 05:47:57] INFO WEBrick::HTTPServer#start done. 2015-12-12T05:47:58.668656+00:00 heroku[web.1]: Process exited with status 143 2015-12-12T15:25:42.166048+00:00 heroku[web.1]: Unidling 2015-12-12T15:25:42.166363+00:00 heroku[web.1]: State changed from down to starting 2015-12-12T15:25:43.961413+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 31053 -e production` 2015-12-12T15:25:47.675210+00:00 app[web.1]: [2015-12-12 15:25:47] INFO WEBrick 1.3.1 2015-12-12T15:25:47.675235+00:00 app[web.1]: [2015-12-12 15:25:47] INFO ruby 2.0.0 (2014-11-13) [x86_64-linux] 2015-12-12T15:25:47.675544+00:00 app[web.1]: [2015-12-12 15:25:47] INFO WEBrick::HTTPServer#start: pid=3 port=31053 2015-12-12T15:25:48.347999+00:00 heroku[web.1]: State changed from starting to up 2015-12-12T15:25:49.238228+00:00 app[web.1]: => Booting WEBrick 2015-12-12T15:25:49.238232+00:00 app[web.1]: => Rails 4.1.6 application starting in production on http://0.0.0.0:31053 2015-12-12T15:25:49.238233+00:00 app[web.1]: => Run `rails server -h` for more startup options 2015-12-12T15:25:49.238235+00:00 app[web.1]: => Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option) 2015-12-12T15:25:49.238235+00:00 app[web.1]: => Ctrl-C to shutdown server 2015-12-12T15:25:49.238236+00:00 app[web.1]: Started GET "/" for 98.196.181.134 at 2015-12-12 15:25:49 +0000 2015-12-12T15:25:49.371270+00:00 app[web.1]: Processing by UsersController#index as HTML 2015-12-12T15:25:49.385278+00:00 heroku[router]: at=info method=GET path="/" host=appname.herokuapp.com request_id=276e00fc-cadd-4b08-ac52-6d72099c9c2e fwd="98.196.181.134" dyno=web.1 connect=1ms service=156ms status=500 bytes=1754 2015-12-12T15:25:49.384220+00:00 app[web.1]: LINE 1: SELECT "users".* FROM "users" 2015-12-12T15:25:49.384216+00:00 app[web.1]: PG::UndefinedTable: ERROR: relation "users" does not exist 2015-12-12T15:25:49.384221+00:00 app[web.1]: ^ 2015-12-12T15:25:49.384222+00:00 app[web.1]: : SELECT "users".* FROM "users" 2015-12-12T15:25:49.384742+00:00 app[web.1]: Rendered users/index.html.erb within layouts/application (3.7ms) 2015-12-12T15:25:49.384868+00:00 app[web.1]: Completed 500 Internal Server Error in 14ms 2015-12-12T15:25:49.387101+00:00 app[web.1]: 2015-12-12T15:25:49.387105+00:00 app[web.1]: LINE 1: SELECT "users".* FROM "users" 2015-12-12T15:25:49.387103+00:00 app[web.1]: ActionView::Template::Error (PG::UndefinedTable: ERROR: relation "users" does not exist 2015-12-12T15:25:49.387105+00:00 app[web.1]: ^ 2015-12-12T15:25:49.387106+00:00 app[web.1]: : SELECT "users".* FROM "users"): 2015-12-12T15:25:49.387107+00:00 app[web.1]: 15: 2015-12-12T15:25:49.387107+00:00 app[web.1]: 14: 2015-12-12T15:25:49.387110+00:00 app[web.1]: 17: <% @users.each do |user| %> 2015-12-12T15:25:49.387110+00:00 app[web.1]: 18: 2015-12-12T15:25:49.387108+00:00 app[web.1]: 16: 2015-12-12T15:25:49.387112+00:00 app[web.1]: 20:<%= user.address %> 2015-12-12T15:25:49.387111+00:00 app[web.1]: 19:<%= user.name %> 2015-12-12T15:25:49.387116+00:00 app[web.1]: app/views/users/index.html.erb:17:in `_app_views_users_index_html_erb___3405507757113956440_70276178207640' 2015-12-12T15:25:49.387118+00:00 app[web.1]: 2015-12-12T15:25:49.387117+00:00 app[web.1]: 2015-12-12T15:27:59.501112+00:00 heroku[router]: at=info method=GET path="/" host=appname.herokuapp.com request_id=279ab493-5a01-4b89-b0a8-cbc9cb51fe83 fwd="98.196.181.134" dyno=web.1 connect=0ms service=18ms status=500 bytes=1754 2015-12-12T15:27:59.486906+00:00 app[web.1]: Started GET "/" for 98.196.181.134 at 2015-12-12 15:27:59 +0000 2015-12-12T15:27:59.496321+00:00 app[web.1]: LINE 1: SELECT "users".* FROM "users" 2015-12-12T15:27:59.496322+00:00 app[web.1]: ^ 2015-12-12T15:27:59.496318+00:00 app[web.1]: PG::UndefinedTable: ERROR: relation "users" does not exist 2015-12-12T15:27:59.496323+00:00 app[web.1]: : SELECT "users".* FROM "users" 2015-12-12T15:27:59.499226+00:00 app[web.1]: 2015-12-12T15:27:59.496875+00:00 app[web.1]: Rendered users/index.html.erb within layouts/application (2.7ms) 2015-12-12T15:27:59.496993+00:00 app[web.1]: Completed 500 Internal Server Error in 4ms 2015-12-12T15:27:59.499229+00:00 app[web.1]: ActionView::Template::Error (PG::UndefinedTable: ERROR: relation "users" does not exist 2015-12-12T15:27:59.499231+00:00 app[web.1]: ^ 2015-12-12T15:27:59.499230+00:00 app[web.1]: LINE 1: SELECT "users".* FROM "users" 2015-12-12T15:27:59.499231+00:00 app[web.1]: : SELECT "users".* FROM "users"): 2015-12-12T15:27:59.499233+00:00 app[web.1]: 16: 2015-12-12T15:27:59.499232+00:00 app[web.1]: 14: 2015-12-12T15:27:59.499233+00:00 app[web.1]: 15: 2015-12-12T15:27:59.499234+00:00 app[web.1]: 17: <% @users.each do |user| %> 2015-12-12T15:27:59.499235+00:00 app[web.1]: 18:2015-12-12T15:27:59.499239+00:00 app[web.1]: 2015-12-12T15:27:59.499237+00:00 app[web.1]: 20: <%= user.address %> 2015-12-12T15:27:59.499236+00:00 app[web.1]: 19:<%= user.name %> 2015-12-12T15:27:59.499239+00:00 app[web.1]: app/views/users/index.html.erb:17:in `_app_views_users_index_html_erb___3405507757113956440_70276178207640' 2015-12-12T15:27:59.499240+00:00 app[web.1]: 2015-12-12T15:27:59.493196+00:00 app[web.1]: Processing by UsersController#index as HTML 2015-12-12T15:28:02.359919+00:00 app[web.1]: Started GET "/" for 98.196.181.134 at 2015-12-12 15:28:02 +0000 2015-12-12T15:28:02.366634+00:00 app[web.1]: PG::UndefinedTable: ERROR: relation "users" does not exist 2015-12-12T15:28:02.366638+00:00 app[web.1]: ^ 2015-12-12T15:28:02.366639+00:00 app[web.1]: : SELECT "users".* FROM "users" 2015-12-12T15:28:02.366637+00:00 app[web.1]: LINE 1: SELECT "users".* FROM "users" 2015-12-12T15:28:02.367435+00:00 app[web.1]: Rendered users/index.html.erb within layouts/application (3.1ms) 2015-12-12T15:28:02.367587+00:00 app[web.1]: Completed 500 Internal Server Error in 4ms 2015-12-12T15:28:02.369955+00:00 app[web.1]: 2015-12-12T15:28:02.369959+00:00 app[web.1]: LINE 1: SELECT "users".* FROM "users" 2015-12-12T15:28:02.370984+00:00 heroku[router]: at=info method=GET path="/" host=appname.herokuapp.com request_id=2b1fbddf-0ef7-4d8c-9107-9e67a2a1ca6a fwd="98.196.181.134" dyno=web.1 connect=0ms service=14ms status=500 bytes=1754 2015-12-12T15:28:02.369958+00:00 app[web.1]: ActionView::Template::Error (PG::UndefinedTable: ERROR: relation "users" does not exist 2015-12-12T15:28:02.363203+00:00 app[web.1]: Processing by UsersController#index as HTML 2015-12-12T15:28:02.369960+00:00 app[web.1]: ^ 2015-12-12T15:28:02.369960+00:00 app[web.1]: : SELECT "users".* FROM "users"): 2015-12-12T15:28:02.369961+00:00 app[web.1]: 14: 2015-12-12T15:28:02.369962+00:00 app[web.1]: 15: 2015-12-12T15:28:02.369963+00:00 app[web.1]: 17: <% @users.each do |user| %> 2015-12-12T15:28:02.369964+00:00 app[web.1]: 18:2015-12-12T15:28:02.369962+00:00 app[web.1]: 16: 2015-12-12T15:28:02.369964+00:00 app[web.1]: 19:<%= user.name %> 2015-12-12T15:28:02.369965+00:00 app[web.1]: 20:<%= user.address %> 2015-12-12T15:28:02.369966+00:00 app[web.1]: app/views/users/index.html.erb:17:in `_app_views_users_index_html_erb___3405507757113956440_70276178207640' 2015-12-12T15:28:02.369967+00:00 app[web.1]: 2015-12-12T15:28:02.369967+00:00 app[web.1]:更新:根据@Vincent的回答,我可以说迁移时不是在Heroku上创建表,所以我尝试从schema.rb加载db,因为我的模式有该表,
$ rake db:schema:load RAILS_ENV=production --trace ** Invoke db:schema:load (first_time) ** Invoke environment (first_time) ** Execute environment ** Invoke db:load_config (first_time) ** Execute db:load_config ** Execute db:schema:load -- enable_extension("plpgsql") -> 0.1872s -- create_table("users", {:force=>true}) -> 0.1565s -- initialize_schema_migrations_table() -> 0.0876s $ heroku restart Restarting dynos... done $ heroku open Opening appname... done $ heroku pg:psql ---> Connecting to HEROKU_POSTGRESQL_WHITE_URL (DATABASE_URL) psql (9.4.5, server 9.3.9) appname::WHITE=> \d List of relations Schema | Name | Type | Owner --------+-------------------+-------+---------------- public | schema_migrations | table | ownername (1 row) $ heroku run rails c Running rails c on appname... up, run.1689 Loading production environment (Rails 4.1.6) irb(main):001:0> ActiveRecord::Base.connection.tables => ["schema_migrations"] irb(main):002:0>如您所见,未创建表用户。另外,schema_migrations为空。
我想念什么?为什么不在prod env中创建表用户?
推荐阅读
如何解决《让我们在modulus.io上加密证书》经验,为你挑选了1个好方法。 ... [详细] 如何解决《AVR-GCC:错误:行尾的垃圾》经验,为你挑选了1个好方法。 ... [详细] 如何解决《自定义Google登录按钮-iOS》经验,为你挑选了3个好方法。 ... [详细] 如何解决《使用noncopyable成员聚合类的初始化》经验,为你挑选了1个好方法。 ... [详细] 如何解决《EclipseMarsJavaDecompiler》经验,为你挑选了1个好方法。 ... [详细] 如何解决《pandasDataFrame.replace函数在datetime中被破坏》经验,为你挑选了0个好方法。 ... [详细] 如何解决《Angular2和MySQL概念》经验,为你挑选了1个好方法。 ... [详细] 如何解决《Jsoupunescapes特殊人物》经验,为你挑选了0个好方法。 ... [详细] 如何解决《SpringBootWeb应用程序中的角度路由》经验,为你挑选了1个好方法。 ... [详细] 如何解决《尝试追加/替换数组元素时"对成员映射的模糊引用"》经验,为你挑选了1个好方法。 ... [详细] 如何解决《Docker:已安装卷的权限》经验,为你挑选了1个好方法。 ... [详细] 如何解决《SFINAE:std::enable_if作为函数参数》经验,为你挑选了1个好方法。 ... [详细] 如何解决《原型与Flyweight设计模式》经验,为你挑选了1个好方法。 ... [详细] 如何解决《BufferedReaderreadLine()方法返回boolean?》经验,为你挑选了1个好方法。 ... [详细] 如何解决《R:PLM个人和时间固定效应,但没有其他回归因子》经验,为你挑选了1个好方法。 ... [详细] 如何解决《错误:任务执行失败:ransformException》经验,为你挑选了1个好方法。 ... [详细] 如何解决《逗号之后我不想要空格宽度-最佳做法?》经验,为你挑选了1个好方法。 ... [详细] 如何解决《Java:字符串模式:如何为具有特殊字符的所有字符字符指定正则表达式》经验,为你挑选了1个好方法。 ... [详细] 如何解决《如何在UITextField中添加图像和文本作为swift中心的占位符》经验,为你挑选了0个好方法。 ... [详细] 如何解决《Rspec:如何创建模拟关联》经验,为你挑选了0个好方法。 ... [详细]吐了个 "CAO" !Tags | 热门标签RankList | 热门文章
- 1Postgres创建/恢复在亚马逊ec2上花费了大量时间
- 2带有多个跨度的文本溢出省略号
- 3如何在动态生成的表行jquery中添加和操作id
- 4如何检测无法在android中连接wifi?
- 5添加按钮到以编程方式创建的UIView
- 6如何从主目录访问产品风味类?
- 7Android数据绑定NoSuchMethodError
- 8Spring Boot - 字体很棒的OTS解析错误:无法转换
- 9为什么YYYY-MM-DD!= YYYY/MM/DD
- 10使用whatsapp分享链接
- 11如何减少if语句的长列表?
- 12使用斯坦福NLP(StanfordNERTagger和StanfordPOSTagger)为西班牙语设置NLTK
- 13由于LayoutManager为NULL,RecycleView在Fragment中崩溃
- 14在npm脚本中用uglify和exorcist管道浏览
- 15设置Highcharts x轴标签的宽度
- 16如何在之前添加hover for ::
- 17Android:无法解决android studio中的依赖项
- 18请求caretRectForPosition:NSTextStorage有很多变化
- 19静态成员函数与C语言绑定?
- 20为什么GNU binutils和GDB合并为一个包?
DevBox开发工具箱 | 专业的在线开发工具网站 京公网安备 11010802040832号 | 京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有