Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am writing my first ever ruby on rails app.

Locally its great, I can visit localhost:3000/ and get the default landing page, and I can visit /users to interact with a scaffold object called User.

I am using postgresql for my db and this again works locally.

I want to deploy this project to heroku. I make sure git is pushed to heroku, which it is, I also ran heroku addons:add heroku-postgresql:development and i also run heroku run rake db:migrate which completes with no output.

When I visit my applications URL I see nothing :https://whats-on-today.herokuapp.com/ Heroku logs shows a http 404:

2014-12-02T17:03:48.311284+00:00 heroku[router]: at=info method=GET path="/" host=whats-on-today.herokuapp.com request_id=fcb9cc27-e5eb-4760-bc30-8a72fe2f0bbc fwd="195.212.29.67" dyno=web.1 connect=1ms service=10ms status=404 bytes=1829

I am not sure why I can access the root url http://localhost:3000/ locally no problem, on deployment to heroku I see nothing? There is nothing much of use in the logs other than the 404. What is my deployed http path? Surely this should work if it works locally?

Can somebody please help?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

You did not define a root route. Try something like this in routes.rb

 root 'welcome#index'

(The page welcome/index needs to exist obviously). Your application is deployed correctly as https://whats-on-today.herokuapp.com/users clearly shows.

share|improve this answer
    
You mentioned postgresql: I usually don't have to add any addons, just the following into my gemfile: #heroku group :production do gem 'pg' gem 'rails_12factor' end –  Johannes Dec 2 '14 at 17:21
    
"heroku open" is what you need instead of that gui stuff. –  Johannes Dec 2 '14 at 17:26
    
Nowhere in the heroku docs for ruby on rails postgres did it mention anything about changing my gem file? devcenter.heroku.com/articles/sqlite3#running-rails-on-postgres And yes I tried your suggestions of the icon and it also brings me to that same page - which also fails 404. –  RenegadeAndy Dec 2 '14 at 17:27
    
heroku open also brings you to the same broken 404 ending url : whats-on-today.herokuapp.com –  RenegadeAndy Dec 2 '14 at 17:37
    
read this for help: guides.rubyonrails.org/routing.html –  Johannes Dec 2 '14 at 17:47

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.