Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 4 RAILS_ENV=生产环境';行不通_Ruby On Rails 4 - Fatal编程技术网

Ruby on rails 4 RAILS_ENV=生产环境';行不通

Ruby on rails 4 RAILS_ENV=生产环境';行不通,ruby-on-rails-4,Ruby On Rails 4,我把“RAILS\u ENV=production”放在rake-about中,并没有显示生产信息 deployer@proj:/var/www/proj# RAILS_ENV=production rake about About your application's environment Rails version 4.2.0 Ruby version 2.2.1-p85 (x86_64-linux) RubyGems version

我把“RAILS\u ENV=production”放在rake-about中,并没有显示生产信息

deployer@proj:/var/www/proj# RAILS_ENV=production rake about
About your application's environment
Rails version             4.2.0
Ruby version              2.2.1-p85 (x86_64-linux)
RubyGems version          2.4.6
Rack version              1.6.1
JavaScript Runtime        Node.js (V8)
Middleware                Rack::Sendfile, Rack::Loc.......
Application root          /var/www/proj
Environment               development
Database adapter          mysql2
Database schema version   20150615041442
我甚至尝试: 导出RAILS_ENV=生产 RAILS\u ENV=生产包执行rake db:create
bundle exec rake db:create RAILS_ENV=production已签入RAILS控制台 像这样

加载开发环境(Rails 4.2.1)

试试这个


ENV['RAILS_ENV']| |='production'在environment.rb中

sudo bundle exec rake db:migrate RAILS_ENV=production

sudo bundle exec rake assets:precompile RAILS_ENV=production
这可能对你有帮助


您可以使用
bin/rails db:environment:set rails_ENV=production
设置环境,然后运行rake任务。

ENV['rails_ENV']| |='production'不工作,仍在开发中。