Heroku部署中的应用程序错误(railstutorial.org)

时间:2015-05-09 21:12:07

标签: ruby-on-rails heroku deployment gem pg

我在railstutorial.org的第1章,以及将hello world应用程序部署到Heroku(1.5 Deploying)。 Hello world适用于localhost,但我在Heroku上遇到了应用程序错误。看着日志,heroku抱怨缺少pg gem。

2015-05-09T04:59:12.505197+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/connection_specification.rb:177:in `rescue in spec': Specified 'postgresql' for database adapter, but the gem is not loaded. Add `gem 'pg'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord). (Gem::LoadError)

可能是因为我第一次搞砸了Gemfile,然后Cloud9 IDE的终端窗口停止了键盘输入,所以我不得不重新启动一个新的终端。 无论如何,我想我最后一次做对了。然后Git push没有给出任何错误消息。这是我的Gemfile:

source 'rubygems.org'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails',           '4.2.0'

# Use SCSS for stylesheets
gem 'sass-rails',      '5.0.2'

# Use Uglifier as compressor for JavaScript assets
gem 'uglifier',        '2.5.3'

# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails',    '4.1.0'

# See github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails',    '4.0.3'
# Turbolinks makes following links in your web application faster. Read more: github.com/rails/turbolinks
gem 'turbolinks',      '2.3.0'
# Build JSON APIs with ease. Read more: github.com/rails/jbuilder
gem 'jbuilder',        '2.2.3'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc',            '0.4.0', group: :doc

# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug',          '3.4.0'

  # Use sqlite3 as the database for Active Record
  gem 'sqlite3',         '1.3.9'

  # Access an IRB console on exception pages or by using <%= console %> in views
  gem 'web-console',     '2.0.0'

  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring',          '1.1.3'
end

group :production do
  gem 'pg',             '0.17.1'
  gem 'rails_12factor', '0.0.2'
end

0 个答案:

没有答案