所以我试图做一些Sinatra教程(Darren Jones的JUMP START SINATRA - https://www.sitepoint.com/premium/books/jump-start-sinatra)
在开发模式下使用sqlite数据库时,将站点部署到heroku之前一切正常。
configure :development do
DataMapper.setup(:default, "sqlite3://#{Dir.pwd}/development.db")
end
当他们在Heroku'上设置数据库时,问题就开始出现了。这导致应用程序错误到站点。添加时错误开始:
configure :production do
DataMapper.setup(:default, ENV['DATABASE_URL'])
end
这是来自heroku的一些错误日志
2017-03-07T17:59:07.933651+00:00 heroku[web.1]: Process exited with status 1
2017-03-07T17:59:07.954951+00:00 heroku[web.1]: State changed from starting to crashed
2017-03-07T17:59:07.806844+00:00 app[web.1]: bundler: failed to load command: thin (/app/vendor/bundle/ruby/2.2.0/bin/thin)
2017-03-07T17:59:07.806948+00:00 app[web.1]: LoadError: cannot load such file -- dm-postgres-adapter
2017-03-07T17:59:07.806950+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/dm-core-1.2.1/lib/dm-core/adapters.rb:163:in `require'
2017-03-07T17:59:07.806951+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/dm-core-1.2.1/lib/dm-core/adapters.rb:163:in `load_adapter'
2017-03-07T17:59:07.806952+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/dm-core-1.2.1/lib/dm-core/adapters.rb:133:in `adapter_class'
2017-03-07T17:59:07.806952+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/dm-core-1.2.1/lib/dm-core/adapters.rb:13:in `new'
2017-03-07T17:59:07.806953+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/dm-core-1.2.1/lib/dm-core.rb:230:in `setup'
2017-03-07T17:59:07.806954+00:00 app[web.1]: /app/main.rb:18:in `block in <top (required)>'
2017-03-07T17:59:07.806954+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1411:in `configure'
2017-03-07T17:59:07.806955+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1981:in `block (2 levels) in delegate'
这里是gemfile(从教程中复制)
source :rubygems
gem 'sinatra'
gem 'slim'
gem 'sass'
gem 'dm-core'
gem 'dm-migrations'
gem 'thin'
gem 'pg', :group => :production
gem 'dm-postgres-adapter', :group => :production
gem 'dm-sqlite-adapter', :group => :development
Gemfile.lock的
GEM
remote: http://rubygems.org/
specs:
addressable (2.5.0)
public_suffix (~> 2.0, >= 2.0.2)
daemons (1.2.4)
data_objects (0.10.17)
addressable (~> 2.1)
dm-core (1.2.1)
addressable (~> 2.3)
dm-do-adapter (1.2.0)
data_objects (~> 0.10.6)
dm-core (~> 1.2.0)
dm-migrations (1.2.0)
dm-core (~> 1.2.0)
dm-postgres-adapter (1.2.0)
dm-do-adapter (~> 1.2.0)
do_postgres (~> 0.10.6)
dm-sqlite-adapter (1.2.0)
dm-do-adapter (~> 1.2.0)
do_sqlite3 (~> 0.10.6)
do_postgres (0.10.17)
data_objects (= 0.10.17)
do_sqlite3 (0.10.17)
data_objects (= 0.10.17)
eventmachine (1.2.3)
pg (0.19.0)
public_suffix (2.0.5)
rack (1.6.5)
rack-protection (1.5.3)
rack
sass (3.4.23)
sinatra (1.4.8)
rack (~> 1.5)
rack-protection (~> 1.4)
tilt (>= 1.3, < 3)
slim (3.0.7)
temple (~> 0.7.6)
tilt (>= 1.3.3, < 2.1)
temple (0.7.7)
thin (1.7.0)
daemons (~> 1.0, >= 1.0.9)
eventmachine (~> 1.0, >= 1.0.4)
rack (>= 1, < 3)
tilt (2.0.6)
PLATFORMS
ruby
DEPENDENCIES
dm-core
dm-migrations
dm-postgres-adapter
dm-sqlite-adapter
pg
sass
sinatra
slim
thin
BUNDLED WITH
1.14.3
任何人都知道如何解决这个问题?尝试在stackoverflow上搜索答案。但是找不到有用的东西。
我是编程的新手,而英语甚至不是我的第一语言。如果我的问题中有任何奇怪或错误的话,请原谅我。
感谢您的帮助:D