I built it in a local environment and deployed it on Heroku, but I got this screen.
We're sorry, but something went wrong.
The development environment (deveropment) was MySQL, but Heroku's standard database is PostgreSQL, but it was still MySQL.
Add the following to gem and apply postgreSQL in production environment.
group :production do
gem 'pg', '>= 0.18', '< 2.0'
end
Group: production do
applies only to the production environment.Bundle install, but add --without production
because it is only in the development environment and not needed in the production environment.
$ bundle install --without production
Then edit database.yml. I think it looks like this by default.
database.yml
production:
<<: *default
database: <app_name>_production
username: <app_name>
password: <%= ENV['<app_name>_DATABASE_PASSWORD'] %>
Rewrite this like this.
database.yml
production:
adapter: postgresql
encoding: unicode
pool: 5
database: <app_name>_production
username: <app_name>
password: <%= ENV['<app_name>_DATABASE_PASSWORD'] %>
After that, do heroku push
and don't forget to do
heroku run rails db: migrate``` and it's OK!
Recommended Posts