开发者

How can I define the environment when restarting a Rails app from the command line?

开发者 https://www.devze.com 2023-02-23 15:17 出处:网络
How can I define the environment when restartin开发者_运维百科g a Rails app from the command line?if you meant how to tell rails which environment to load when you start the server from command line,

How can I define the environment when restartin开发者_运维百科g a Rails app from the command line?


if you meant how to tell rails which environment to load when you start the server from command line, here's how:

rails server -e production


In general, Rails gets its environment from the RAILS_ENV shell variable at start-up, or defaults to "development". You can specify an environment for a rails command such as rails server, rails console (Rails 3), script/server or script/console (Rails 2.x) from the bash command line as follows...

RAILS_ENV=something rails s

This means to set the RAILS_ENV environment variable to "something" for the execution of the rails s command.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号