How can I change my RoR app to run in production mode? Is there a config file (environment.rb for example) to do that?
Thank you.
How can I change my RoR app to run in production mode? Is there a config file (environment.rb for example) to do that?
Thank you.
If mipadi's suggestion doesn't work, add this to config/environment.rb
# force Rails into production mode when
# you don't control web/app server and can't set it the proper way
ENV['RAILS_ENV'] ||= 'production'
You can also pass the environment to script/server:
$ script/server -e production
If you're running on Passegner, then the default is to run in production, in your apache conf:
<VirtualHost *:80>
ServerName application_name.rails.local
DocumentRoot "/Users/rails/application_name/public"
RailsEnv production ## This is the default
</VirtualHost>
If you're just running a local server with mongrel or webrick, you can do:
./script/server -e production
or in bash:
RAILS_ENV=production ./script/server
actually overriding the RAILS_ENV constant in the enviornment.rb should probably be your last resort, as it's probably not going to stay set (see another answer I gave on that)
this would now be
rails server -e production
for rails 3 projects.