简体   繁体   中英

changing the rails env. to production

My rails app is working just fine when it is in development mode however if I change it to production mode, it gives something wrong error and I cannot see any reason behind it. Do you know any possible problem ?

This is my error message:

Started GET "/favicon.ico" for 127.0.0.1 at Mon Apr 30 00:55:16 +0300 2012

ActionController::RoutingError (No route matches [GET] "/favicon.ico"):
  actionpack (3.2.1) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
  actionpack (3.2.1) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
  railties (3.2.1) lib/rails/rack/logger.rb:26:in `call_app'
  railties (3.2.1) lib/rails/rack/logger.rb:16:in `call'
  actionpack (3.2.1) lib/action_dispatch/middleware/request_id.rb:22:in `call'
  rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
  rack (1.4.1) lib/rack/runtime.rb:17:in `call'
  activesupport (3.2.1) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
  rack (1.4.1) lib/rack/lock.rb:15:in `call'
  rack-cache (1.1) lib/rack/cache/context.rb:132:in `forward'
  rack-cache (1.1) lib/rack/cache/context.rb:241:in `fetch'
  rack-cache (1.1) lib/rack/cache/context.rb:181:in `lookup'
  rack-cache (1.1) lib/rack/cache/context.rb:65:in `call!'
  rack-cache (1.1) lib/rack/cache/context.rb:50:in `call'
  railties (3.2.1) lib/rails/engine.rb:479:in `call'
  railties (3.2.1) lib/rails/application.rb:220:in `call'
  rack (1.4.1) lib/rack/content_length.rb:14:in `call'
  railties (3.2.1) lib/rails/rack/log_tailer.rb:14:in `call'
  rack (1.4.1) lib/rack/handler/webrick.rb:59:in `service'
  /home/erogol/.rvm/rubies/ruby-1.8.7-p358/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
  /home/erogol/.rvm/rubies/ruby-1.8.7-p358/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
  /home/erogol/.rvm/rubies/ruby-1.8.7-p358/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
  /home/erogol/.rvm/rubies/ruby-1.8.7-p358/lib/ruby/1.8/webrick/server.rb:162:in `start'
  /home/erogol/.rvm/rubies/ruby-1.8.7-p358/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
  /home/erogol/.rvm/rubies/ruby-1.8.7-p358/lib/ruby/1.8/webrick/server.rb:95:in `start'
  /home/erogol/.rvm/ru

Thanks all cares...

when I type rake assets:precompile I got:

rake aborted!
no such file to load -- uglifier
  (in /home/erogol/Dropbox/Bunch_It/app/assets/javascripts/application.js)

Tasks: TOP => assets:precompile:primary
(See full trace by running task with --trace)
rake aborted!
Command failed with status (1): [/home/erogol/.rvm/rubies/ruby-1.8.7-p358/b...]

Tasks: TOP => assets:precompile
(See full trace by running task with --trace)

Try to set config.serve_static_assets = true in \\config\\environments\\production.rb file. That helped me.

from the error message, it is said that Rails can't find the file: /favicon.ico. please make sure it exists.

My first guess if this is only in production and not in development is you may need to compile your assets. You would need to either run:

rake assets:precompile

or change your production.rb environment file to include:

config.assets.compile = true

However, the path in the error mesage is just /favicon.ico not assets/favicon.ico . And, the favicon file should just be in your /public directory. Can you confirm that this is where the file is located?

The problem was about the config.assets.compress = true . It creates problem about my javascript files. I set it false and my app start to work just fine. However I do not know whether making it false causes any loss of my program.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM