I decided to test my app in the production environment today. It’s running fine in test and dev environments. But when I started a mongrel server in production I got a message about assets not being available so I did:
bundle exec rake assets:precompile
Well that got the app booting up but now my images and css are all resolving to 404s. So I think there must be a checklist of things to do to get a Rails 3 app ready for production. I googled a bit but didn’t see anything like “make sure you check/do all these things before you switch to prod”.
My command to start the server: rails s -e production -p 5000 (because I want to run the prod/test/dev mongrels on the same server right now).
So, what do you do when you switch an app from test to production?
Depending on your webserver you may have to change the following setting in config/environments/prodcution.rb from:
config.serve_static_assets = false
To:
config.serve_static_assets = true