无法部署到Heroku

时间:2014-07-07 21:05:16

标签: sql ruby-on-rails git postgresql heroku

好吧,我是新手,在这里真的需要一些指导。

我无法部署到Heroku以挽救我的生命并且已经使用了8个小时并且阅读了我能找到的每个stackoverflow和google帖子。

Ruby版本----> ruby 2.1.2p95(2014-05-08修订版45877)[x86_64-darwin13.0] Rails版本----> Rails 4.0.0 PostgreSQL ----> psql(PostgreSQL)9.3.4

以下是我的观点:

$ git push heroku master
Initializing repository, done.
Counting objects: 62, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (51/51), done.
Writing objects: 100% (62/62), 14.40 KiB | 0 bytes/s, done.
Total 62 (delta 3), reused 0 (delta 0)
    -----> Ruby app detected
    -----> Compiling Ruby/Rails
    -----> Using Ruby version: ruby-2.0.0
    -----> Installing dependencies using 1.6.3
   Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
   Fetching gem metadata from https://rubygems.org/..........
   Fetching additional metadata from https://rubygems.org/..
Installing...etc etc etc

现在我明白了......

Your bundle is complete!
   Gems in the groups development and test were not installed.
   It was installed into ./vendor/bundle
   Post-install message from rdoc:
   Depending on your version of ruby, you may need to install ruby rdoc/ri data:
   <= 1.8.6 : unsupported
   = 1.8.7 : gem install rdoc-data; rdoc-data --install
   = 1.9.1 : gem install rdoc-data; rdoc-data --install
   >= 1.9.2 : nothing to do! Yay!
   Bundle completed (11.95s)
   Cleaning up the bundler cache.
-----> Writing config/database.yml to read from DATABASE_URL
-----> Preparing app for Rails asset pipeline
       Running: rake assets:precompile
       rake aborted!
       Gem::LoadError: Specified 'sqlite3' for database adapter, but the gem is not loaded. Add `gem 'sqlite3'` to your Gemfile.

这就是我的Gemfile的样子:

source 'https://rubygems.org'

gem 'rails', '4.0.0'

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

group :production do
  gem 'pg'
end

gem 'rails_12factor', group: :production


group :assets do
  gem 'sass-rails', '~> 4.0.0'
  gem 'uglifier', '>= 1.3.0'
  gem 'coffee-rails', '~> 4.0.0'
end

这是我的database.yml

development:
 adapter: postgresql
 database: rails_development
 pool: 5
 timeout: 5000

test:
 adapter: postgresql
 database: rails_test
 pool: 5
 timeout: 5000

production:
 adapter: postgresql
 database: rails_production
 pool: 5
 timeout: 5000

2 个答案:

答案 0 :(得分:0)

在命令行中键入以下内容:&#39; gem list&#39; ...如果您看到“sqlite3&#39;”,请告诉我们。在返回的宝石列表中。

另外,将rails_12factor放入生产集团中,如下所示:

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

此外,将此gem添加到您的开发组,并确保在以下情况之后运行bundle install: 宝石&#39; factory_girl_rails&#39;,&#39;〜&gt; 4.0&#39;

答案 1 :(得分:0)

为了最大限度地减少开发和生产之间的差异(Heroku),我在所有环境中都使用了Postgresql数据库。