Luca Romagnoli
Luca Romagnoli

Reputation: 12455

images not found in production mode

i've upgraded my rails's app to rails version 3. when i launch the app in development mode all works. but when i launch it in production mode all the local images aren't showed

ex:

http://localhost:3000/images/background.jpg

i receive this error:

    Started GET "/images/background.jpg?1254155492" for 127.0.0.1 at Fri Nov 26 16:42:53 +0100 2010

ActionController::RoutingError (No route matches "/images/background.jpg"):
  actionpack (3.0.3) lib/action_dispatch/middleware/show_exceptions.rb:53:in `call'
  railties (3.0.3) lib/rails/rack/logger.rb:13:in `call'
  rack (1.2.1) lib/rack/runtime.rb:17:in `call'
  activesupport (3.0.3) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
  rack (1.2.1) lib/rack/lock.rb:11:in `call'
  rack (1.2.1) lib/rack/lock.rb:11:in `synchronize'
  rack (1.2.1) lib/rack/lock.rb:11:in `call'
  railties (3.0.3) lib/rails/application.rb:168:in `call'
  railties (3.0.3) lib/rails/application.rb:77:in `send'
  railties (3.0.3) lib/rails/application.rb:77:in `method_missing'
  railties (3.0.3) lib/rails/rack/log_tailer.rb:14:in `call'
  rack (1.2.1) lib/rack/content_length.rb:13:in `call'
  rack (1.2.1) lib/rack/handler/webrick.rb:52:in `service'
  /accounts/lromagnoli/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
  /accounts/lromagnoli/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
  /accounts/lromagnoli/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
  /accounts/lromagnoli/lib/ruby/1.8/webrick/server.rb:162:in `start'
  /accounts/lromagnoli/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
  /accounts/lromagnoli/lib/ruby/1.8/webrick/server.rb:95:in `start'
  /accounts/lromagnoli/lib/ruby/1.8/webrick/server.rb:92:in `each'
  /accounts/lromagnoli/lib/ruby/1.8/webrick/server.rb:92:in `start'
  /accounts/lromagnoli/lib/ruby/1.8/webrick/server.rb:23:in `start'
  /accounts/lromagnoli/lib/ruby/1.8/webrick/server.rb:82:in `start'
  rack (1.2.1) lib/rack/handler/webrick.rb:13:in `run'
  rack (1.2.1) lib/rack/server.rb:213:in `start'
  railties (3.0.3) lib/rails/commands/server.rb:65:in `start'
  railties (3.0.3) lib/rails/commands.rb:30
  railties (3.0.3) lib/rails/commands.rb:27:in `tap'
  railties (3.0.3) lib/rails/commands.rb:27
  script/rails:6:in `require'
  script/rails:6

Rendered /accounts/lromagnoli/lib/ruby/gems/1.8/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (0.9ms)

why?

how can i solve it?

thanks

Upvotes: 2

Views: 2416

Answers (2)

Gediminas Šukys
Gediminas Šukys

Reputation: 7391

You can try this also: config.assets.compile = true

Upvotes: 0

Sinetris
Sinetris

Reputation: 8945

You need to change the configuration in config/environments/production.rb from

config.serve_static_assets = false

to

config.serve_static_assets = true

Upvotes: 4

Related Questions