Sinatra + Heroku + Datamapper deploy issues with dm-sqlite-adapter

后端 未结 2 1661
悲哀的现实
悲哀的现实 2021-02-10 04:07

For some reason, heroku tries to require dm-sqlite-adapter, even though it should use Postgres here. Note, that this happens when I open any URL - not during the git push itself

相关标签:
2条回答
  • 2021-02-10 04:35

    Well, too many Rails apps on Heroku, I took the shared db presence for granted. heroku config showed neither DATABASE_URL or SHARED_DATABASE_URL set.

    Issuing heroku addons:add shared-database:5mb solved the problem.

    Strange, that the db wasn't automatically added, despite having 'pg' gem in Gemfile.

    Quote from http://devcenter.heroku.com/articles/cedar:

    A Heroku shared PostgreSQL database (shared-database:5mb) will be automatically added to your app in any of the following cases:

    • The app is a Rails application
    • The pg gem is specified in the Gemfile
    0 讨论(0)
  • 2021-02-10 04:48

    Try doing DataMapper.setup(:default, ENV['DATABASE_URL'] || 'postgres://user:password@hostname/data/mydatabase.db') instead. Heroku is probably looking at the protocol, and therefore requiring SQLite’s dependencies.

    0 讨论(0)
提交回复
热议问题