2012-03-27 7 views
8

私はローカルコンピュータで完全に動作しているレールアプリを持っています。しかし、私はHerokuの上でそれを展開していたとき、私は、ブラウザで次のエラーが表示されます。リソースの読み込みに失敗しました:サーバが404のステータス(Not Found)で応答しました

Failed to load resource: the server responded with a status of 404 (Not Found) http://hollow-cloud-nnn.herokuapp.com/stylesheets/application.css 
Failed to load resource: the server responded with a status of 404 (Not Found) http://hollow-cloud-nnn.herokuapp.com/javascripts/application.js 

私はスタイルシートフォルダ\ JavaScriptと\アプリケーション\資産\アプリケーション\資産でこのファイルを持っています。ここで

は私のconfig \のproduction.rbである:ここで

# Disable Rails's static asset server (Apache or nginx will already do this) 
config.serve_static_assets = false 

# Compress JavaScripts and CSS 
config.assets.compress = true 

# Don't fallback to assets pipeline if a precompiled asset is missed 
config.assets.compile = true 

# Generate digests for assets URLs 
config.assets.digest = true 

は、展開のコンソール出力です:

 Using mongoid (2.4.7) 
     Using rails (3.2.1) 
     Using sass (3.1.15) 
     Using sass-rails (3.2.5) 
     Using uglifier (1.2.3) 
     Your bundle is complete! It was installed into ./vendor/bundle 
     Cleaning up the bundler cache. 
-----> Writing config/database.yml to read from DATABASE_URL 
-----> Rails plugin injection 
     Injecting rails_log_stdout 
     Injecting rails3_serve_static_assets 
-----> Discovering process types 
     Procfile declares types  -> (none) 
     Default types for Ruby/Rails -> console, rake, web, worker 
-----> Compiled slug size is 15.8MB 
-----> Launching... done, v24 
     http://hollow-cloud-7412.herokuapp.com deployed to Heroku 

To [email protected]:hollow-cloud-7412.git 
    cb8ded3..dc103ac master -> master 

私はそれを解決することができますか?

答えて

17

precompile assetsまたはconfig.assets.compile = trueを運用環境に設定する必要があります。

詳しい情報はheroku開発センターでご利用いただけます。how to use rails 3.1+ asset pipeline on herokuをお読みください。

+0

に次の行を追加し、これを解決するにはconfig/application.rb

require 'rails/all' 

にこの行を削除するように指示するように、これは、Mongoidユーザーのための非常に一般的な問題です成功しなかった。私はより多くの情報を与えるために私の質問を更新しました。 – demas

+0

'... herokuapp.com/stylesheets/application.css'フォルダ内のファイルを検索するのは正しいですか? ( 'public'フォルダがありません – demas

+0

ライブコンパイル中にアプリケーションを再起動しようとしましたか? '/ public/assets'フォルダ内にファイルが生成されます – NARKOZ

0

raong 3.1以降を実行しているmongoidユーザーのようです。ドキュメントは、私はそれを修正しようとしていたconfig/application.rb

require 'sprocket/railtie' 
関連する問題