2017-04-15 3 views
-2

に私がローカルに完全に罰金働いているレールのアプリを持っていますが、私はそれが「アプリケーションエラー」enter image description hereのRailsアプリがローカルに作業しますが、生産

を示すHerokuの上でそれを押したときに、私はHerokuのアプリのログを訪問しようとしたが、何もなかったではありませんそこに、私はherokoコンソールで実行しようとしたときには、このエラーを与え始め:

C:\Sites\bbb>heroku run rails console 
This is the legacy Heroku CLI. Please install the new CLI from https://cli.herok 
u.com 
Running rails console on hidden-hollows-63773... up, run.4100 (Free) 
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.2/lib/active_record/connecti 
on_adapters/connection_specification.rb:176:in `rescue in spec': Specified 'sqli 
te3' for database adapter, but the gem is not loaded. Add `gem 'sqlite3'` to you 
r Gemfile (and ensure its version is at the minimum required by ActiveRecord). (
Gem::LoadError) 
     from /app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.2/lib/active_re 
cord/connection_adapters/connection_specification.rb:173:in `spec' 
     from /app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.2/lib/active_re 
cord/connection_handling.rb:53:in `establish_connection' 
     from /app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.2/lib/active_re 
cord/railtie.rb:125:in `block (2 levels) in <class:Railtie>' 
     from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.2/lib/active_s 
upport/lazy_load_hooks.rb:43:in `instance_eval' 
     from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.2/lib/active_s 
upport/lazy_load_hooks.rb:43:in `execute_hook' 
     from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.2/lib/active_s 
upport/lazy_load_hooks.rb:50:in `block in run_load_hooks' 
     from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.2/lib/active_s 
upport/lazy_load_hooks.rb:49:in `each' 
     from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.2/lib/active_s 
upport/lazy_load_hooks.rb:49:in `run_load_hooks' 
     from /app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.2/lib/active_re 
cord/base.rb:324:in `<module:ActiveRecord>' 
     from /app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.2/lib/active_re 
cord/base.rb:24:in `<top (required)>' 
     from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.2/lib/active_s 
upport/dependencies.rb:293:in `require' 
     from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.2/lib/active_s 
upport/dependencies.rb:293:in `block in require' 
     from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.2/lib/active_s 
upport/dependencies.rb:259:in `load_dependency' 
     from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.2/lib/active_s 
upport/dependencies.rb:293:in `require' 
     from /app/app/models/application_record.rb:1:in `<top (required)>' 
     from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.2/lib/active_s 
upport/dependencies.rb:293:in `require' 
     from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.2/lib/active_s 
upport/dependencies.rb:293:in `block in require' 
     from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.2/lib/active_s 
upport/dependencies.rb:259:in `load_dependency' 
     from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.2/lib/active_s 
upport/dependencies.rb:293:in `require' 
     from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.2/lib/active_s 
upport/dependencies.rb:380:in `block in require_or_load' 
     from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.2/lib/active_s 
upport/dependencies.rb:37:in `block in load_interlock' 
     from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.2/lib/active_s 
upport/dependencies/interlock.rb:12:in `block in loading' 
     from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.2/lib/active_s 
upport/concurrency/share_lock.rb:150:in `exclusive' 
     from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.2/lib/active_s 
upport/dependencies/interlock.rb:11:in `loading' 
     from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.2/lib/active_s 
upport/dependencies.rb:37:in `load_interlock' 
     from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.2/lib/active_s 
upport/dependencies.rb:358:in `require_or_load' 
     from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.2/lib/active_s 
upport/dependencies.rb:336:in `depend_on' 
     from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.2/lib/active_s 
upport/dependencies.rb:252:in `require_dependency' 
     from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/engine. 
rb:476:in `block (2 levels) in eager_load!' 
     from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/engine. 
rb:475:in `each' 
     from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/engine. 
rb:475:in `block in eager_load!' 
     from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/engine. 
rb:473:in `each' 
     from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/engine. 
rb:473:in `eager_load!' 
     from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/engine. 
rb:354:in `eager_load!' 
     from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/applica 
tion/finisher.rb:59:in `each' 
     from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/applica 
tion/finisher.rb:59:in `block in <module:Finisher>' 
     from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/initial 
izable.rb:30:in `instance_exec' 
     from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/initial 
izable.rb:30:in `run' 
     from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/initial 
izable.rb:55:in `block in run_initializers' 
     from /app/vendor/ruby-2.3.4/lib/ruby/2.3.0/tsort.rb:228:in `block in tso 
rt_each' 
     from /app/vendor/ruby-2.3.4/lib/ruby/2.3.0/tsort.rb:350:in `block (2 lev 
els) in each_strongly_connected_component' 
     from /app/vendor/ruby-2.3.4/lib/ruby/2.3.0/tsort.rb:431:in `each_strongl 
y_connected_component_from' 
     from /app/vendor/ruby-2.3.4/lib/ruby/2.3.0/tsort.rb:349:in `block in eac 
h_strongly_connected_component' 
     from /app/vendor/ruby-2.3.4/lib/ruby/2.3.0/tsort.rb:347:in `each' 
     from /app/vendor/ruby-2.3.4/lib/ruby/2.3.0/tsort.rb:347:in `call' 
     from /app/vendor/ruby-2.3.4/lib/ruby/2.3.0/tsort.rb:347:in `each_strongl 
y_connected_component' 
     from /app/vendor/ruby-2.3.4/lib/ruby/2.3.0/tsort.rb:226:in `tsort_each' 
     from /app/vendor/ruby-2.3.4/lib/ruby/2.3.0/tsort.rb:205:in `tsort_each' 
     from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/initial 
izable.rb:54:in `run_initializers' 
     from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/applica 
tion.rb:352:in `initialize!' 
     from /app/config/environment.rb:5:in `<top (required)>' 
     from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/applica 
tion.rb:328:in `require' 
     from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/applica 
tion.rb:328:in `require_environment!' 
     from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/command 
s/commands_tasks.rb:157:in `require_application_and_environment!' 
     from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/command 
s/commands_tasks.rb:77:in `console' 
     from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/command 
s/commands_tasks.rb:49:in `run_command!' 
     from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/command 
s.rb:18:in `<top (required)>' 
     from /app/bin/rails:4:in `require' 
     from /app/bin/rails:4:in `<main>' 

マイGemfile

source 'https://rubygems.org' 

git_source(:github) do |repo_name| 
    repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/") 
    "https://github.com/#{repo_name}.git" 
end 


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 
gem 'rails', '~> 5.0.2' 
# Use sqlite3 as the database for Active Record 

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

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

# Use Puma as the app server 
gem 'puma', '~> 3.0' 
# Use SCSS for stylesheets 
gem 'sass-rails', '~> 5.0' 
# Use Uglifier as compressor for JavaScript assets 
gem 'uglifier', '>= 1.3.0' 
# Use CoffeeScript for .coffee assets and views 
gem 'coffee-rails', '~> 4.2' 
# See https://github.com/rails/execjs#readme for more supported runtimes 
# gem 'therubyracer', platforms: :ruby 

# Use jquery as the JavaScript library 
gem 'jquery-rails' 
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks 
gem 'turbolinks', '~> 5' 
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder 
gem 'jbuilder', '~> 2.5' 
# Use Redis adapter to run Action Cable in production 
# gem 'redis', '~> 3.0' 
# Use ActiveModel has_secure_password 
# gem 'bcrypt', '~> 3.1.7' 

# 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', platform: :mri 
end 

group :development do 
    # Access an IRB console on exception pages or by using <%= console %> anywhere in the code. 
    gem 'web-console', '>= 3.3.0' 
end 

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem 
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] 
Herokuのは、sqlite3のをサポートしていないよう

マイdatabase.ymlのは、あなたのdatabase.ymlファイルで

# SQLite version 3.x 
# gem install sqlite3 
# 
# Ensure the SQLite 3 gem is defined in your Gemfile 
# gem 'sqlite3' 
# 
default: &default 
    adapter: sqlite3 
    pool: 5 
    timeout: 5000 

development: 
    <<: *default 
    database: db/development.sqlite3 

# 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: 
    <<: *default 
    database: db/test.sqlite3 

production: 
    <<: *default 
    database: db/production.sqlite3 
+1

gemファイルによると、sqlite gemは実稼働環境にはロードされず、テストと開発のみがロードされます。生産に宝石を加える。 – dbugger

+2

最初に、生産と開発に異なるDBを使用しているのはなぜですか? – RSB

答えて

0

は、PostgreSQLを使用するために、生産DBを変更します。

たとえば:あなたはdefualt値を含めているので、それはsqliteのように設定なっている。このコードでだから

production: 
    database: example_production 
    adapter: postgresql 
    host: localhost 
    password: 
1

あなたはこのコード

default: &default 
    adapter: sqlite3 
    pool: 5 
    timeout: 5000 

で、デフォルトのデータベースとしてのsqliteを設定しています、 herokuではsqliteを使用できないため、herokuでは動作しません。

production: 
    <<: *default 
    database: db/production.sqlite3 

database.ymlファイルの本番データベースの値を変更する必要があります。

production: 
    adapter: postgresql 
    pool: 5 
    timeout: 5000 
    database: app_name 
関連する問題