heroku无法使用rails应用程序

时间:2013-06-27 17:21:36

标签: ruby ruby-on-rails-3 heroku

我真的被Heroku的问题所困扰。我是一个全新的人,我已经尝试了一些解决方案,他们似乎没有帮助我。这是我使用

的错误
group :development, :test do
gem 'sqlite3'
end

在gem文件中这是我对sqlite 3的条目

Gem files will remain installed in /tmp/build_2i8tok6rv3gyk/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.7 for inspection.
Results logged to /tmp/build_2i8tok6rv3gyk/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.7/ext/sqlite3/gem_make.out
   An error occurred while installing sqlite3 (1.3.7), and Bundler cannot continue.
   Make sure that `gem install sqlite3 -v '1.3.7'` succeeds before bundling.
!
!     Failed to install gems via Bundler.
!     
!     Detected sqlite3 gem which is not supported on Heroku.
!     https://devcenter.heroku.com/articles/sqlite3
!
!     Push rejected, failed to compile Ruby/Rails app

To git@heroku.com:glacial-wildwood-5205.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:glacial-wildwood-5205.git'

2 个答案:

答案 0 :(得分:1)

heroku不支持sqlite3,而是使用Postgresql

group :development do
   gem 'sqlite3'
end

group :test, :production do
    gem 'pg'
end

通过这种方式,sqlite将成为您的本地数据库,而postgres将用于测试和生产

答案 1 :(得分:1)

您需要更改Gemfile

gem 'pg'添加到您的生产组

group :production do
  gem "pg"
end

然后确保在提交heroku之前运行bundle install

整本指南应该可以帮助您入门:https://devcenter.heroku.com/articles/ruby#using-a-sql-database