Sinatra 资产未在 Heroku 上加载

Sinatra assets not loading on Heroku

我建立了一个 Sinatra 网站并推送到 Heroku,但不知何故 CSS、public 文件夹中的 JS 和图像未加载。

站点在这里:https://teng-quora-k.herokuapp.com/

这是本地的样子:

这是<head>部分

<head>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
    <link rel="stylesheet" href="/css/normalize.css">
    <link rel="stylesheet" href="/css/application.css">
    <link rel="stylesheet" href="/css/login.css">
    <link rel="shortcut icon" href="/favicon.ico">
    <title>Teng-Quora-k</title>
    <script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
    <script src="/js/application.js"></script>
</head>

这是 Gemfile,以防万一

source 'https://rubygems.org'

# Ruby Version
# ruby "2.2.1"

gem 'sinatra'
gem 'sinatra-contrib'
gem 'thin'
gem 'activerecord'
gem 'activesupport'
gem 'sinatra-activerecord'
gem 'pg'
gem 'rake'
gem 'rspec'

group :development, :test do
    gem 'shotgun'
end

group :production do
    gem 'rails_12factor'
    gem 'puma'
end

gem 'bcrypt'
gem 'byebug'
gem 'will_paginate', '~> 3.0.6'
gem 'faker'

这在我的 procfile 中:

web: bundle exec puma -t 5:5 -p ${PORT:-3000} -e ${RACK_ENV:-development}

我在这里错过了什么?

我尝试在 config/init 中专门定义 public 文件夹路径,它成功了!这是路径:

# Setup public folder
set :public_folder, File.join(APP_ROOT, "public")

希望有一天有人会发现这个有用:)