Heroku에서 제공되지 않는 정적 자산 (이미지 및 js 및 스타일 시트)에 문제가 있습니다. 내 로컬 dev env에서 올바르게 작동합니다.Heroku/Thin에서 정적 자산이 제공되지 않음
오류는 다음과 같습니다 :
2011-08-08T02:58:45+00:00 app[web.1]: Started GET "/stylesheets/reset.css" for 98.234.235.21 at 2011-08-07 19:58:45 -0700
2011-08-08T02:58:45+00:00 app[web.1]:
2011-08-08T02:58:45+00:00 app[web.1]: ActionController::RoutingError (No route matches "/stylesheets/reset.css"):
내가 사용 :
- 루비 1.9.2
- 레일 3.0.7
- 에게 Heroku를 대나무 MRI-1.9.2와 함께 얇은 웹 서버.
내가 구글/유래에 검색 한 (나는 heroku.com에 기본 설치 방법을 기본 다음)과 행운과 함께 다음과 같은 시도 :
- 제거 config.ru
- 가
use ActionDispatch::Static, "#{Rails.root}/public"
추가를 config.ru - 는
사람이 수정을 제안 할 수 staging.rb에서 config.serve_static_assets = true
을 설정? Bamboo 대신 Cedar를 사용해야합니까? 얇은 대신 다른 것을 사용해야합니까?
감사합니다.
편집 : JS 파일이 제공되고 있지만, 이미지와 스타일이 아니다. 링크의 경로가 일관성이 있는지 확인했습니다.
myapp.heroku.com/stylesheets/reset.css
은 - myapp.heroku.com/javascripts/jquery.js
실패 - 나는 또한 다음과 같은 설정을 시도
config.action_dispatch.x_sendfile_header = nil
. 이것은
config.serve_static_assets = true
과 함께 진행되었지만 Heroku는 설정 방법에 관계없이 이러한 옵션을 강제로 적용한다는 사실을 알게되었습니다. 즉, 그것은 시작하는 동안 다음을 수행합니다
-----> Detected Rails is not set to serve static_assets
Installing rails3_serve_static_assets... done
-----> Configure Rails 3 to disable x-sendfile
Installing rails3_disable_x_sendfile... done
라이언에서 지원되지 않는 전무로 설정 x_sendfile_header을 해달라고 응용 프로그램 컨테이너