Heroku rails控制台不再启动

我在heroku(cedar-stack)上运行rails控制台时遇到问题。 以下每个命令heroku运行控制台,heroku运行rails控制台,heroku运行包exec rails控制台导致以下错误消息:

运行bundle exec rails console连接到终端… up,run.8155

中止测试:您的Rails环境正在生产模式下运行!

这个错误信息有点混乱。 什么样的测试尝试heroku开始? 我只是想启动4周前运行良好的控制台。

对于Cedar Stack及以后:

 heroku run rails console --app  

以前的堆栈可以使用此命令:

 heroku run console --app  

如果您有多个环境(登台/生产/等),则需要以下命令:

 heroku run -a app-name console 

如果您只有一个环境而且从不设置暂存或其他环境,则可以运行:

 heroku run console 

https://github.com/nemrow/rails_app_cheatsheet/blob/master/heroku.rdoc

出于某种原因,您需要在Procfile显式定义控制台进程:

 # Procfile web: script/rails server -p $PORT console: script/rails console 

此博客文章包含更多详细信息: http : //platypus.belighted.com/blog/2013/01/21/ruby-2-rails-4-heroku/

您应该使用heroku run console因为其他人已经回答。

Heroku一次只能在一个环境中运行, 由RAILS_ENV和RACK_ENV环境变量配置 。

连接时,控制台将自动使用正确的环境。

我遇到了同样的问题,我决定这样做而且有效

 $ heroku run bash $ cd bin ~/bin $ ruby rails console