Rails 4 assets not found in production (digest path is OK) -
i have problem assets in production.
i can't load stylesheets, javascripts or images.
when try access something, shows me error - not found when try access -digest, it's ok.
i have assets precompiled, deployed via capistrano manifest -> assets_manifest.json
thanks
log: stylesheet error (stylesheet loaded themes_for_rails gem) when try access /assets/default/stylesheets/application-ec9a310f792c60f2f77810cfcd9b903f.css , ok
i, [2013-07-17t14:38:45.120183 #31938] info -- : started "/assets/default/stylesheets/application.css?locale=cs" 90.181.17.25 @ 2013-07-17 14:38:45 +0200 i, [2013-07-17t14:38:45.123007 #31938] info -- : processing themesforrails::assetscontroller#stylesheets css i, [2013-07-17t14:38:45.123429 #31938] info -- : parameters: {"locale"=>"cs", "theme"=>"navarsi", "asset"=>"application"} i, [2013-07-17t14:38:45.124912 #31938] info -- : rendered text template (0.0ms) i, [2013-07-17t14:38:45.125177 #31938] info -- : completed 404 not found in 2ms (views: 0.5ms | activerecord: 0.0ms)
image log error:
actioncontroller::routingerror (no route matches [get] "/assets/icons/flags/24/cs.png"): actionpack (4.0.0) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call' actionpack (4.0.0) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call' railties (4.0.0) lib/rails/rack/logger.rb:38:in `call_app' railties (4.0.0) lib/rails/rack/logger.rb:21:in `block in call' activesupport (4.0.0) lib/active_support/tagged_logging.rb:67:in `block in tagged' activesupport (4.0.0) lib/active_support/tagged_logging.rb:25:in `tagged' activesupport (4.0.0) lib/active_support/tagged_logging.rb:67:in `tagged' railties (4.0.0) lib/rails/rack/logger.rb:21:in `call' actionpack (4.0.0) lib/action_dispatch/middleware/request_id.rb:21:in `call' rack (1.5.2) lib/rack/methodoverride.rb:21:in `call' rack (1.5.2) lib/rack/runtime.rb:17:in `call' activesupport (4.0.0) lib/active_support/cache/strategy/local_cache.rb:83:in `call' railties (4.0.0) lib/rails/engine.rb:511:in `call' railties (4.0.0) lib/rails/application.rb:97:in `call' railties (4.0.0) lib/rails/railtie/configurable.rb:30:in `method_missing' /usr/local/rvm/gems/ruby-1.9.3-p125/gems/passenger-3.0.11/lib/phusion_passenger/rack/request_handler.rb:96:in `process_request' /usr/local/rvm/gems/ruby-1.9.3-p125/gems/passenger-3.0.11/lib/phusion_passenger/abstract_request_handler.rb:513:in `accept_and_process_next_request' /usr/local/rvm/gems/ruby-1.9.3-p125/gems/passenger-3.0.11/lib/phusion_passenger/abstract_request_handler.rb:274:in `main_loop' /usr/local/rvm/gems/ruby-1.9.3-p125/gems/passenger-3.0.11/lib/phusion_passenger/rack/application_spawner.rb:206:in `start_request_handler' /usr/local/rvm/gems/ruby-1.9.3-p125/gems/passenger-3.0.11/lib/phusion_passenger/rack/application_spawner.rb:171:in `block in handle_spawn_application' /usr/local/rvm/gems/ruby-1.9.3-p125/gems/passenger-3.0.11/lib/phusion_passenger/utils.rb:479:in `safe_fork' /usr/local/rvm/gems/ruby-1.9.3-p125/gems/passenger-3.0.11/lib/phusion_passenger/rack/application_spawner.rb:166:in `handle_spawn_application' /usr/local/rvm/gems/ruby-1.9.3-p125/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop' /usr/local/rvm/gems/ruby-1.9.3-p125/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously' /usr/local/rvm/gems/ruby-1.9.3-p125/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb:180:in `start' /usr/local/rvm/gems/ruby-1.9.3-p125/gems/passenger-3.0.11/lib/phusion_passenger/rack/application_spawner.rb:129:in `start' /usr/local/rvm/gems/ruby-1.9.3-p125/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb:253:in `block (2 levels) in spawn_rack_application' /usr/local/rvm/gems/ruby-1.9.3-p125/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server_collection.rb:132:in `lookup_or_add' /usr/local/rvm/gems/ruby-1.9.3-p125/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb:246:in `block in spawn_rack_application' /usr/local/rvm/gems/ruby-1.9.3-p125/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server_collection.rb:82:in `block in synchronize' <internal:prelude>:10:in `synchronize' /usr/local/rvm/gems/ruby-1.9.3-p125/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize' /usr/local/rvm/gems/ruby-1.9.3-p125/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb:244:in `spawn_rack_application' /usr/local/rvm/gems/ruby-1.9.3-p125/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb:137:in `spawn_application' /usr/local/rvm/gems/ruby-1.9.3-p125/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application' /usr/local/rvm/gems/ruby-1.9.3-p125/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop' /usr/local/rvm/gems/ruby-1.9.3-p125/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously' /usr/local/rvm/gems/ruby-1.9.3-p125/gems/passenger-3.0.11/helper-scripts/passenger-spawn-server:99:in `<main>'
this production environment config
project::application.configure # settings specified here take precedence on in config/application.rb. config.assets.precompile << ckeditor.assets config.assets.precompile << %w(*/fonts/**/*.*) config.assets.precompile << %w(*.png *.jpg *.jpeg *.gif) # code not reloaded between requests. config.cache_classes = true # eager load code on boot. eager loads of rails , # application in memory, allowing both thread web servers # , relying on copy on write perform better. # rake tasks automatically ignore option performance. config.eager_load = true # full error reports disabled , caching turned on. config.consider_all_requests_local = false config.action_controller.perform_caching = true # enable rack::cache put simple http cache in front of application # add `rack-cache` gemfile before enabling this. # large-scale production use, consider using caching reverse proxy nginx, varnish or squid. # config.action_dispatch.rack_cache = true # disable rails's static asset server (apache or nginx this). config.serve_static_assets = true # compress javascripts , css. config.assets.js_compressor = :uglifier config.assets.css_compressor = :sass # not fallback assets pipeline if precompiled asset missed. config.assets.compile = false # config.assets.compile = true # generate digests assets urls. config.assets.digest = true # version of assets, change if want expire assets. config.assets.version = '1.0' # specifies header server uses sending files. # config.action_dispatch.x_sendfile_header = "x-sendfile" # apache # config.action_dispatch.x_sendfile_header = 'x-accel-redirect' # nginx # force access app on ssl, use strict-transport-security, , use secure cookies. # config.force_ssl = true # set :debug see in log. config.log_level = :info # prepend log lines following tags. # config.log_tags = [ :subdomain, :uuid ] # use different logger distributed setups. # config.logger = activesupport::taggedlogging.new(sysloglogger.new) # use different cache store in production. # config.cache_store = :mem_cache_store # enable serving of images, stylesheets, , javascripts asset server. # config.action_controller.asset_host = "http://assets.example.com" # precompile additional assets. # application.js, application.css, , non-js/css in app/assets folder added. # config.assets.precompile += %w( search.js ) # ignore bad email addresses , not raise email delivery errors. # set true , configure email server immediate delivery raise delivery errors. # config.action_mailer.raise_delivery_errors = false # enable locale fallbacks i18n (makes lookups locale fall # i18n.default_locale when translation can not found). config.i18n.fallbacks = true # send deprecation notices registered listeners. config.active_support.deprecation = :notify # disable automatic flushing of log improve performance. # config.autoflush_log = false # use default logging formatter pid , timestamp not suppressed. config.log_formatter = ::logger::formatter.new end
you might having same problem described here: no route matches [get] /assets
basically, if you're using rails server test app, precompiled assets wont served default. rails expects web server (apache, nginx, etc) serve them up. need make change config/environments/production.rb , set serve_static_assets true.
Comments
Post a Comment