我在使用Sinatra框架在Cloud 9中进行的课程中构建了一个应用程序,并使用Heroku进行部署。但是,当我启动应用程序时,我收到应用程序错误。我有以下文件;
config.ru
require ::File.expand_path('../config/environment', __FILE__)
set :app_file, __FILE__
run Sinatra::Application
的environment.rb
require 'rubygems'
require 'bundler/setup'
require 'active_support/all'
# Load Sinatra Framework (with AR)
require 'sinatra'
require 'sinatra/activerecord'
require 'sinatra/contrib/all' # Requires cookies, among other things
require 'pry'
APP_ROOT = Pathname.new(File.expand_path('../../', __FILE__))
APP_NAME = APP_ROOT.basename.to_s
# Sinatra configuration
configure do
set :root, APP_ROOT.to_path
set :server, :puma
enable :sessions
set :session_secret, ENV['SESSION_KEY'] || 'lighthouselabssecret'
set :views, File.join(Sinatra::Application.root, "app", "views")
end
# Set up the database and models
require APP_ROOT.join('config', 'database')
# Load the routes / actions
require APP_ROOT.join('app', 'actions')
EDITS
Heroku Logs
2017-06-06T13:44:57.586652+00:00 heroku[web.1]: Starting process with command `bundle exec ruby environment.rb -p 35256`
2017-06-06T13:45:00.219635+00:00 heroku[web.1]: Process exited with status 1
2017-06-06T13:45:00.138353+00:00 app[web.1]: ruby: No such file or directory -- environment.rb (LoadError)
2017-06-06T13:45:00.221194+00:00 heroku[web.1]: State changed from starting to crashed
2017-06-06T15:14:43.483731+00:00 heroku[web.1]: State changed from crashed to starting
2017-06-06T15:14:46.326391+00:00 heroku[web.1]: Starting process with command `bundle exec ruby environment.rb -p 43667`
2017-06-06T15:14:49.114108+00:00 app[web.1]: ruby: No such file or directory -- environment.rb (LoadError)
2017-06-06T15:14:49.213798+00:00 heroku[web.1]: State changed from starting to crashed
2017-06-06T15:14:49.200516+00:00 heroku[web.1]: Process exited with status 1
2017-06-06T15:44:11.537127+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=stormy-atoll-29193.herokuapp.com request_id=1eecc885-da1a-4333-8254-7f05febc23db fwd="170.146.14.41" dyno= connect= service= status=503 bytes= protocol=https
2017-06-06T15:44:11.767259+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=stormy-atoll-29193.herokuapp.com request_id=eb39d22e-fe01-4abd-8ccf-1a5d17635b7d fwd="170.146.14.41" dyno= connect= service= status=503 bytes= protocol=https
Procfile
web: bundle exec ruby web.rb -p $PORT
非常感谢任何帮助!