2012-03-27 21 views
8

की स्थिति के साथ जवाब दिया मेरे पास रेल ऐप है जो स्थानीय कंप्यूटर में पूरी तरह से काम कर रहा है। लेकिन जब मैं Heroku पर उसे लागू करने से कर रहा हूँ मैं ब्राउज़र में अगले त्रुटि मिलती है:संसाधन लोड करने में विफल: सर्वर ने 404 (नहीं मिला)

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 

मैं एप्लिकेशन \ संपत्ति \ जावास्क्रिप्ट और \ एप्लिकेशन \ संपत्ति \ फ़ोल्डर स्टाइलशीट में इस फाइल को की है।

यहाँ मेरी 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 dev center पर उपलब्ध है, how to use rails 3.1+ asset pipeline on heroku पढ़ें।

+0

मैं इसे ठीक करने के लिए कोशिश कर रहा था में निम्नलिखित पंक्ति जोड़ हिदायत, लेकिन सफलता नहीं मिली। मैंने अधिक जानकारी देने के लिए अपना प्रश्न अपडेट किया है। – demas

+0

क्या यह सही है, कि रेल ... 'herokuapp.com/stylesheets/application.css' फ़ोल्डर में खोज फाइलें? ('Public' फ़ोल्डर गुम है। – demas

+0

क्या आपने ऐप को पुनरारंभ करने का प्रयास किया है? लाइव संकलन के दौरान यह '/ public/assets' फ़ोल्डर में फाइलें उत्पन्न करेगा। – NARKOZ

0

ऐसा लगता है कि आप एक मोंगोइड उपयोगकर्ता चल रहे रेल 3.1+ हैं। यह Mongoid उपयोगकर्ताओं के लिए काफी एक आम मुद्दा है प्रलेखन के रूप में आप, में config/application.rb

require 'rails/all' 

इसके समाधान के लिए इस लाइन को हटाने के लिए config/application.rb

require 'sprocket/railtie' 
संबंधित मुद्दे