Evanto
Evanto

Reputation: 350

Rails App Deploy to Heroku Error

I’m trying to deploy my first app from Github to Heroku. I press “Deploy branch” and get message:

“Your app was successfully deployed”

But when I open the view, I see the following message instead of my app:

“Application error. An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details”

I’ve tried many things to fix it, but the result is still the same and can’t find what I’m doing wrong. How can I fix my deploy correctly and see my app up and running on Heroku?

Heroku build log:

https://gist.github.com/Evanto/4ce2afa5a9e75b7154727356d77737e1

Github branch I’m trying to deploy to Heroku:

https://github.com/Evanto/MovieApp/tree/heroku

https://movieapps.herokuapp.com/

Upvotes: 1

Views: 2264

Answers (2)

Arslan Ali
Arslan Ali

Reputation: 17802

In your logs, it says the following:

Gem::LoadError: Specified 'postgresql' for database adapter, but the gem is not loaded. Add gem 'pg' to your Gemfile

Heroku supports only pg as the database of choice, so you need to add the following line to your Gemfile.

gem 'pg'

Edit:

No, you do need to need any username or password in your database.yml file for Heroku. Writing the following in the said file will work fine for you.

default: &default
  adapter: postgresql
  encoding: unicode
  pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>

development:
  <<: *default
  database: project_name_development
production:
  <<: *default
  database: project_name_production
test:
  <<: *default
  database: project_name_test

Upvotes: 2

puneet18
puneet18

Reputation: 4427

Gemfile

gem 'pg'

config/database.yml

default: &default
  adapter: postgresql
  pool: 5
  timeout: 5000
  username : root
  password : root
  database: db_name

development:
  <<: *default

test:
  <<: *default

production:
  <<: *default

On terminal:

rake db:migrate

Upvotes: 2

Related Questions