Я использовал приложение с "rails new * -d postgres", поэтому подумал, что оно будет настроено без следа sqlite.Я сделал это, потому что у меня были проблемы с изменением базы данных с sqlite3 на postgres, поэтому решил начать с нуля, так как это небольшое приложение.Приложение отлично работает в разработке, и я могу нажать на heroku, но когда я захожу на сайт URL, возникает ошибка приложения.
Вот мои логи heroku:
2018-10-11T18:46:38.075927+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/command.rb:44:in `invoke'
2018-10-11T18:46:38.075934+00:00 app[web.1]: from bin/rails:9:in `<main>'
2018-10-11T18:46:38.075929+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/commands.rb:16:in `<top (required)>'
2018-10-11T18:46:38.075926+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/command/base.rb:63:in `perform'
2018-10-11T18:46:38.075921+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:130:in `perform'
2018-10-11T18:46:38.075930+00:00 app[web.1]: from bin/rails:9:in `require'
2018-10-11T18:46:38.081926+00:00 app[web.1]: => Booting Puma
2018-10-11T18:46:38.081929+00:00 app[web.1]: => Rails 5.1.4 application starting in production
2018-10-11T18:46:38.081930+00:00 app[web.1]: => Run `rails server -h` for more startup options
2018-10-11T18:46:38.081931+00:00 app[web.1]: Exiting
2018-10-11T18:47:37.504750+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=freezer-club.herokuapp.com request_id=403d6804-9f7d-4c3d-8906-4c371d4a0d9f fwd="79.73.149.134" dyno= connect= service= status=503 bytes= protocol=https
2018-10-11T18:47:37.974359+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=freezer-club.herokuapp.com request_id=fb7146b2-e59b-4394-bd93-e5fcbc270a0f fwd="79.73.149.134" dyno= connect= service= status=503 bytes= protocol=https
2018-10-11T18:49:34.962091+00:00 app[api]: Starting process with command `rails console` by user ffrench.m@hotmail.com
2018-10-11T18:49:38.091356+00:00 heroku[run.3046]: Awaiting client
2018-10-11T18:49:38.122034+00:00 heroku[run.3046]: Starting process with command `rails console`
2018-10-11T18:49:38.349498+00:00 heroku[run.3046]: State changed from starting to up
2018-10-11T18:49:44.109740+00:00 heroku[run.3046]: State changed from up to complete
2018-10-11T18:49:44.095976+00:00 heroku[run.3046]: Process exited with status 1
Вотмой database.yml:
default: &default
adapter: postgresql
encoding: unicode
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
development:
<<: *default
database: freezer-club_development
production:
<<: *default
database: freezer-club_production
username: freezer-club
password: <%= ENV['FREEZER-CLUB_DATABASE_PASSWORD'] %>
Я включил гем pg в Gemfile, а не гем sqlite.
Когда я пытаюсь запустить консоль heroku, я получаю эту ошибку:
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/
connection_adapters/connection_specification.rb:188:in `rescue in spec':
Specified 'sqlite3' for database adapter, but the gem is not loaded.
Add `gem 'sqlite3'` to your Gemfile (and ensure its version is at the
minimum required by ActiveRecord). (Gem::LoadError)
This is my 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
gem 'rails', '~> 5.1.4'
gem 'pg', '~> 0.21'
gem 'puma', '~> 3.7'
gem 'sass-rails', '~> 5.0'
gem 'slim-rails'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.2'
gem 'turbolinks', '~> 5'
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'
group :development, :test do
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
gem 'capybara', '~> 2.13'
gem 'selenium-webdriver'
end
group :development do
gem 'web-console', '>= 3.3.0'
gem 'listen', '>= 3.0.5', '< 3.2'
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', платформы: [: mingw,: mswin,: x64_mingw,: jruby]