0

だから私はRoRに関するHartlのチュートリアルを読んでいて、第7章の終わりにいます。herokuにデプロイしようとしています。までのすべて

heroku run rake db:migrate

ステップは機能しますが、そのステップで以下のエラーが発生します。何度か走りましbundle installたが、どこに問題があるのか​​わかりません。heroku create --stack cedarまた、実行してから実行しても、オンラインでherokuアプリにアクセスできませんgit push heroku。herokuアプリのURLにアクセスすると、アプリケーションエラーが発生します。

現在Postgres.appを実行していますが、Railsサーバーがデプロイされていません。

含まれているのはmyGemfiledatabase.ymlです。http://github.com/sambaekでコードを自由に見てください

誰かが助けることができますか?ありがとう!

端子出力

heroku run rake db:migrate
Running `rake db:migrate` attached to terminal... up, run.1
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7)
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7)
Connecting to database specified by DATABASE_URL
rake aborted!
Please install the postgresql adapter: `gem install activerecord-postgresql-adapter` (pg is not part of the bundle. Add it to Gemfile.)

Tasks: TOP => db:migrate => db:load_config
(See full trace by running task with --trace)

Gemfile

source 'https://rubygems.org'

gem 'rails', '3.2.8'
gem 'bootstrap-sass', '2.0.4'
gem 'bcrypt-ruby', '3.0.1'

group :development, :test do
  gem 'rspec-rails', '2.11.0'
  gem 'guard-rspec', '0.5.5'
  gem 'pg'
  # gem 'sqlite3'
  gem 'guard-spork', '0.3.2'
  gem 'spork', '0.9.0'
  gem 'factory_girl_rails', '1.4.0'
end

gem 'annotate', '2.5.0', group: :development

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '3.2.5'
  gem 'coffee-rails', '3.2.2'
  gem 'uglifier', '1.2.3'
end

gem 'jquery-rails', '2.0.2'

group :test do
  gem 'capybara', '1.1.2'
  gem 'rb-fsevent', '0.9.1', :require => false
  gem 'growl', '1.0.3'
end

config / database.yml

# postgresql
development:
  host: localhost
  adapter: postgresql
  encoding: utf8
  database: sample_app_development
  pool: 5
  username: 
  password: 

test:
  host: localhost
  adapter: postgresql
  encoding: utf8
  database: sample_app_test
  pool: 5
  username: 
  password: 

production:
  adapter: postgresql
  encoding: utf8
  database: sample_app_production
  pool: 5
  username:
  password:


# sqlite3
# development:
#   adapter: sqlite3
#   database: db/development.sqlite3
#   pool: 5
#   timeout: 5000

# # Warning: The database defined as "test" will be erased and
# # re-generated from your development database when you run "rake".
# # Do not set this db to the same as development or production.
# test:
#   adapter: sqlite3
#   database: db/test.sqlite3
#   pool: 5
#   timeout: 5000

# production:
#   adapter: sqlite3
#   database: db/production.sqlite3
#   pool: 5
#   timeout: 5000
4

2 に答える 2

2

2つの問題:

  1. githubのコードは、pggemがproductionグループに含まれていることを示しています。このグループから削除するだけで、すべての環境に含まれるようになります。
  2. Gemfileあなたのとを表示するあなたの質問への更新config/database.ymlは、 GemをHerokuによってインストールされないpg内部testと環境に配置しますdevelopment

以下にあなたの答えがありますが、ファイルに基づいて、すべての環境でPostgresを使用している場合は、 pggemをグループに入れる必要はありませconfig/database.ymlん。

于 2012-09-08T18:23:47.197 に答える
1

そのため、実行したときに、に別のグループがなかったため、gemheroku run rake db:migrateをインストールしていなかったことがわかりました。今は動作します。問題を解決するために時間を割いてくれた人に感謝します!pgproductionGemfile

于 2012-09-08T18:21:57.163 に答える