Ruby-on-rails Heroku rails 控制台不再启动

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16472981/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 21:57:43  来源:igfitidea点击:

Heroku rails console does not start any more

ruby-on-railsherokuconsole

提问by Micha

I have an issue with running the rails console at heroku (cedar-stack). Each of the following commands heroku run console, heroku run rails console, heroku run bundle exec rails console results in the following error-message:

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

Running bundle exec rails consoleattached to terminal... up, run.8155

运行bundle exec rails console附加到终端... up, run.8155

Abort testing: Your Rails environment is running in production mode!

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

This error-message is a little bit confused. What kind of test tries heroku to start? I just want to fire up the console, which had worked fine 4 weeks ago.

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

回答by Chris Barretto

For Cedar Stack and later:

对于 Cedar Stack 及更高版本:

heroku run rails console --app <app name>

Previous stacks could use this command:

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

heroku run console --app <app name>

回答by Jordan Rumpelstiltskin Nemrow

If you have multiple environments (staging / production / etc) you need this command:

如果您有多个环境(暂存/生产/等),则需要此命令:

heroku run -a app-name console

If you only have a single environment and never setup staging or other environments you can just run:

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

heroku run console

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

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

回答by Naiguel Developer

I was with the same problem and I decided to do this and it worked

我遇到了同样的问题,我决定这样做并且它奏效了

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

回答by Christos Zisopoulos

For some reason you need to explicitly define the console process in the Procfile:

出于某种原因,您需要在以下内容中明确定义控制台进程Procfile

# Procfile

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

This blog post has more details: http://platypus.belighted.com/blog/2013/01/21/ruby-2-rails-4-heroku/

这篇博文有更多细节:http: //platypus.belighted.com/blog/2013/01/21/ruby-2-rails-4-heroku/

回答by jordelver

You should just use heroku run consoleas others have answered.

你应该heroku run console像其他人回答的那样使用。

Heroku only runs in one environment at a time, which is configured by the RAILS_ENV and RACK_ENV environments variables.

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

When you connect, the console will use the correct environment automatically.

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