2013-07-21 3 views
2

현재 Herails를 현재 Rails 4.0.0 프로젝트의 호스트로 사용하고 있습니다. 이것이 Heroku 사용자를위한 정기적 인 문제인 것처럼 보이지만, 내가 찾은 해결책 중 어느 것도 나를 위해 어떤 변화도 가져 오지 않았습니다.Heroku가 자산에서 파일을 제공하지 않습니다.

서버에서 애셋의 이미지, CSS 또는 j 중 일부를 제공하지 않습니다.

내가 해봤 추가 보석 :

gem 'rails_log_stdout',   github: 'heroku/rails_log_stdout' 
gem 'rails3_serve_static_assets', github: 'heroku/rails3_serve_static_assets' 
gem 'rails_12factor' 

production.rb에있는 설정 옵션을 설정 :

config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" 
config.serve_static_assets = true 
config.assets.initialize_on_precompile = false 
다양한 조합

있지만 서버는 여전히 자산 중 하나를로드 할 수 없습니다.

간단하고 빠진 경우를 대비하여 코드를 GitHub에 커밋 한 후 git push staging master을 실행합니다. 내 개발 컴퓨터는 Windows 8 컴퓨터입니다.

config.assets.compile = true 
config.assets.digest = true 

config.assets.initialize_on_precompile 라인을 제거하고 있습니다되었습니다 당신은 또한 설정을 시도, 생산 config 파일에서

Counting objects: 11, done. 
Delta compression using up to 8 threads. 
Compressing objects: 100% (6/6), done. 
Writing objects: 100% (6/6), 569 bytes, done. 
Total 6 (delta 4), reused 0 (delta 0) 

-----> Ruby/Rails app detected 
-----> Using Ruby version: ruby-2.0.0 
-----> Installing dependencies using Bundler version 1.3.2 
     Running: bundle install --without development:test --path vendor/bundle - 
-binstubs vendor/bundle/bin 
     Updating git://github.com/milgner/compass-rails.git 
     Fetching gem metadata from https://rubygems.org/.......... 
     Fetching gem metadata from https://rubygems.org/.. 
     Resolving dependencies... 
     Using rake (10.1.0) 
     Using i18n (0.6.4) 
     Using minitest (4.7.5) 
     Using multi_json (1.7.7) 
     Using atomic (1.1.10) 
     Using thread_safe (0.1.0) 
     Using tzinfo (0.3.37) 
     Using activesupport (4.0.0) 
     Using builder (3.1.4) 
     Using erubis (2.7.0) 
     Using rack (1.5.2) 
     Using rack-test (0.6.2) 
     Using actionpack (4.0.0) 
     Using mime-types (1.23) 
     Using polyglot (0.3.3) 
     Using treetop (1.4.14) 
     Using mail (2.5.4) 
     Using actionmailer (4.0.0) 
     Using activemodel (4.0.0) 
     Using activerecord-deprecated_finders (1.0.3) 
     Using arel (4.0.0) 
     Using activerecord (4.0.0) 
     Using bundler (1.3.2) 
     Using chunky_png (1.2.8) 
     Using coffee-script-source (1.6.3) 
     Using execjs (1.4.0) 
     Using coffee-script (2.2.0) 
     Using thor (0.18.1) 
     Using railties (4.0.0) 
     Using coffee-rails (4.0.0) 
     Using fssm (0.2.10) 
     Using sass (3.2.9) 
     Using compass (0.12.2) 
     Using compass-rails (1.0.3) from git://github.com/milgner/compass-rails.g 
it (at 1749c06) 
     Using hike (1.2.3) 
     Using jbuilder (1.4.2) 
     Using jquery-rails (3.0.4) 
     Using json (1.8.0) 
     Using modernizr-rails (2.6.2.3) 
     Using pg (0.15.1) 
     Using tilt (1.4.1) 
     Using sprockets (2.10.0) 
     Using sprockets-rails (2.0.0) 
     Using rails (4.0.0) 
     Using rails_serve_static_assets (0.0.1) 
     Using rails_stdout_logging (0.0.1) 
     Using rails_12factor (0.0.2) 
     Using rdoc (3.12.2) 
     Using sass-rails (4.0.0) 
     Using sdoc (0.3.20) 
     Using turbolinks (1.3.0) 
     Using uglifier (2.1.2) 
     Using zurb-foundation (4.0.9) 
     Your bundle is complete! It was installed into ./vendor/bundle 
     Cleaning up the bundler cache. 
     Removing rails_log_stdout (01b5bcc572e3) 
     Removing rails3_serve_static_assets (84910ceb4ca2) 
-----> Writing config/database.yml to read from DATABASE_URL 
-----> Preparing app for Rails asset pipeline 
     Running: rake assets:precompile 
     Asset precompilation completed (13.42s) 
     Cleaning assets 
-----> WARNINGS: 
     Removing `Gemfile.lock` because it was generated on Windows. 
     Bundler will do a full resolve so native gems are handled properly. 
     This may result in unexpected gem versions being used in your app. 
-----> Discovering process types 
     Procfile declares types  -> (none) 
     Default types for Ruby/Rails -> console, rake, web, worker 

-----> Compiled slug size: 37.0MB 
-----> Launching... done, v16 
     http://myproject.herokuapp.com deployed to Heroku 

To [email protected]:myproject.git 
    82f4d58..e930ff1 master -> master 
+0

'git push heroku'의 로그를 추가하십시오. –

+0

추가되었습니다. 감사합니다 @MichaelSzyndel – Godwin

+0

그래, 컴파일이 계속 진행됩니다. 정말로'config.serve_static_assets = true'를 설정해야합니까? 기본적으로 거짓이며이 방법으로 유지해야한다고 생각합니다. –

답변

1

: 여기에 편집

git push staging master 실행에서 출력 레일즈 4에는 필요 없습니다.

또한 rails_12factor gem은 s입니다. et는 당신이 heroku를 위해 필요로하는 2 개의 다른 보석들을 포함하기 때문에, 그것들을 Gemfile에 포함 할 필요가 없습니다. 자세한 내용은 github 페이지에서 확인할 수 있습니다.

그러나 무엇보다도 나는 image_tag 레일을 사용하여 프로덕션 환경에 이미지를 표시해야합니다. 당신이 그렇게하고 있는지 확실하지 않지만, 내 애플 리케이션에 큰 변화를 가져왔다.

희망이 도움이됩니다.

+0

고마워요. 'config.assets.compile'은'false'로 설정되었지만'true'로 변경해도 효과가 없습니다. 응. – Godwin

+0

Bummer. 그 두 줄은 나를 위해 속임수를 썼다. 호기심에서, 나는 당신이 생산이 아닌 준비 환경으로 나아가고 있다는 것을 알게되었습니다. staging.rb 환경 파일에서 논의 된 모든 변경 사항을 적용 했습니까? – oolong

+0

아니요. 그럴 필요가 없습니다. 나는 하나를 필요로하는지 전혀 몰랐습니다. 제 'production.rb'를 사용해 왔습니다.이것은 분명히 원인이 될 수 있지만 나는 오늘 저녁에 그것을해야만합니다. 감사! – Godwin

관련 문제