2017-08-20 21 views
0

タイトルによれば、私はHerokuに私の公的資産を使用させることはできません。公開ディレクトリがSinatraで提供されていない

ローカルでは、私のアプリをshotgunで実行すると動作します。しかしrackup(Herokuのは、使用するもの)、CSSと資産404

と私はここでの回答(onetwothree)の束を試したが、どれも働いていません。

dir struct

マイconfig.ru:

require 'bundler' 
Bundler.require 

require File.expand_path('../config/environment', __FILE__) 

run BikeShareApp 

そして、私のコントローラ:

class BikeShareApp < Sinatra::Base 
    get '/' do 
    erb :'home/index' 
    end 

    get '/stations' do 
    @stations = Station.all 
    erb :'stations/index' 
    end 
end 

編集:ここでは

は私のディレクトリ構造だこれは私が参照してる方法です私の資産は道で

<link href="/css/bootstrap.min.css" rel="stylesheet"> 
<link href="/css/overwrite.css" rel="stylesheet"> 

答えて

0

それを見つけました。

thisガイドに続いて、私のconfig.ruでこれを置くことは働いた:

run lambda { |env| 
    [ 
    200, 
    { 
     'Content-Type' => 'text/html', 
     'Cache-Control' => 'public, max-age=86400' 
    } 
    ] 
} 
関連する問題