The page you were looking for doesn't exist - ruby-on-rails

I'm trying to learn Rails ( developpment beginner here )
When I try to deploy my first app on Heroku and execute $ heroku open I got
"The page you were looking for doesn't exist.”
In my Heroku control pannel I also have a second link who works, http://secret-refuge-2130.herokuapp.com/, but different from localhost.
Here's my first app https://github.com/Freysh/first_app

As Michael Hartl propose "Unfortunately, the resulting page is an error; as of Rails 4.0, for technical reasons the default Rails page doesn’t work on Heroku. The good news is that the error will go away (in the context of the full sample application) when we add a root route in Section 5.3.2."
You need to work on the Root route of your routes.rb in config folder.

Looks like you haven't pushed your repo to Heroku yet?
Since you're new, let me give you some ideas about how Heroku works, and how you can deploy your app to it...
Heroku
When you use Heroku, you basically get a bare git repo which you can push your application to. This repo will essentially allow you to use the following commands:
> $ git add .
> $ git commit -a -m "Your App"
> $ git push heroku master
This is, of course, only possible if you have added your heroku repo to your local remote repositories:
> $ git remote add heroku https://heroku.com/......
When you push your local repo to your Heroku one, Heroku then runs what's known as a buildpack:
When you git push heroku, Heroku’s slug compiler prepares your code
for execution by the Heroku dyno manager. At the heart of the slug
compiler is a collection of scripts called a buildpack.
Heroku’s Cedar
stack has no native language or framework support; Ruby, Python, Java,
Clojure, Node.js and Scala are all implemented as buildpacks.
This means that when you push your app to your repo, Heroku will endeavour to compile & run it for you. This is when the app will run.
Fix
To fix, you should follow the tutorial here
Basically, you need to get your git repo created locally, which will then provide you with the ability to push to your remote heroku repo

Related

starting with heroku; fail updating rails app

after a few months learning a bit about rails and making some stuff local, I wanted to try to upload a simple rails app to heroku. Which, by the way, was a pain in the ass because of installing issues of Postgresql. But ok, that's done.
Now I create an app on heroku, I did the login, key thing, git, and uploaded. Was fine, very easy after all. I just uploaded an empty rails app, to try heroku.
Well, then I add a controller. Upload again via git push heroku master and not so fine! I did scaffold, for my articulo controller. And I wasn't able to open the URL once pushed to heroke on someurl/articulos. I got an 404 heroku message here: http://enigmatic-scrubland-8865.herokuapp.com/articulos
Then I create a controller for the home site and get rid of the "welcome aboard" default site. Again push heroku... On terminal I got messages all updated, and lauching. All fine.
But then I access and again, the "welcome aboard" default page.
Locally it works fine. But now I'm not sure if I'm doing it well. It scares me that no failing messages are to see nowhere, but obviously it fails.
After editing my rails app, I always do this:
$ git init
$ git add .
$ git commit -m "init"
$ git push heroku master
Like the documentation says on heroku. But, no error and no updating.
Thanks in advice.
From what I see from heroku devcenter, the git init part is only to be done on the first initial creation of the git repo, not "After editing my rails app".
In other words, you shouldn't have to "always do" a git init after editing your rail apps.
For the first push, I would recommend a:
git push -u heroku master
That way, all the subsequent push will be a simple:
git push

How to use a heroku app that already exists

please help me,
when I want to upload an rails app to heroku I do this sequence and works creating a new project on heroku
git init
git add .
git commit -m "init"
heroku create
git push heroku master
and then I get a new url like http://-somethingdiferent-.herokuapp.com each time that I need to deploy an project
I dont know how to use that project later without creating other new heroku project
I was thinking to use something like pull of git, but I dont know how is the pull on heroku, maybe -git pull heroku master? but in that case, how can I pull the same project?
please I will like if you know the sequence or any tutorial?
thanks
Try to create an app first
# run this command from the app folder to create a new app
$ heroku open --app the-app-name
# Add it to the remote
$ heroku git:remote -a the-app-name
# push app to heroku
$ git push heroku master
the-app-name shall be replaced by the application name.
one can find more useful stuff here.

rails app in development doesn't show up on heroku

Im developing a rails app. Following this tutorial here:
Tutorial
I finished a part and wanted to push all the changes up to heroku and view them there. I can view the site on my local machine. On heroku all I see is this:
I typed in the following commands after I made my changes, saw the site was working on my local computer.
$ git add .
$ git commit -m "Finish layout and routes"
$ git checkout master
$ git push
$ git push heroku
$ heroku open
I even looked at the heroku logs but couldn't make sense of whats going wrong! There is no content in my database, its empty. I just have views setup.
Why did you checkout to master? Are you working on another branch?
If that is the case, you will need to merge your changes to master before pushing your code (supposing you are on master which is already the case after the checkout):
git merge other-branch
Also don't forget to migrate your database on heroku.
heroku rake db:migrate
EDIT
To find out your current branch, type:
git branch
It will mark the current branch with a '*'.
If you have removed the public/index.html file, you'll have to do git rm public/index.html as well, then commit and push to Heroku. If you delete a file locally, git won't pick up on that without doing the git rm, and Heroku's knowledge of your app is 100% through Git.
I had a similarly strange (but unrelated) problem when I had an app that was storing uploaded files on Heroku. Every time I'd do a push they'd all go away. It confused me greatly until I realized that Heroku essentially wipes every time you do a push, and anything that isn't in git isn't kept. A good reason to use S3 or similar for uploaded file storage.

How to reset everything Heroku in my Git/Rails 3.1 Project

I solved my problem while writing this post, but I thought this might be good information for other noobs like me :)
To solve the problem below edit the following file
.git/config
There's a section that looks like this
[remote "heroku"]
url = git#heroku.com:adjective-noun-1234.git
fetch = +refs/heads/*:refs/remotes/heroku/*
This is what git tries to push to. Just change the line
url = git#heroku.com:adjective-noun-1234.git
to whatever new Heroku project you created. Git should now be able to push to Heroku again.
I have gotten my second Rails app ever to a working state and want to deploy it. So I followed all the steps for Heroku deployment in the Ruby on Rails Tutorial (I had the deployment working for the sample app from the book) using:
heroku create
I then push my project with
git push heroku master
The project doesn't work although I can't find any errors in the Heroku logs, all I get is:
We're sorry, but something went wrong.
We've been notified about this issue and we'll take a look at it
shortly.
So I looked around the Heroku Support Section and found the official Rails 3.0 / 3.1 deployment guide:
http://devcenter.heroku.com/articles/rails3
http://devcenter.heroku.com/articles/rails31_heroku_cedar
I went to the Heroku Web Frontend > General Info > Destroy App because I wanted to continue my efforts with a clean slate.
Following the guide I created a Heroku project for the cedar stack:
heroku create --stack cedar
And push it to Heroku using
git push heroku master
THE PROBLEM: for some reason git is still trying to push to the old Heroku project!!!
resulting in an error
fatal: The remote end hung up unexpectedly
Check your remote repositories, and update it to the new heroku name:
git remote -v
Then remove the heroku one that is wrong:
git remote rm heroku
Then add the new one
git remote add heroku git#heroku.com:sitename.git
This is a bit extreme, but worked for me....
heroku destroy appname
heroku create
git push heroku master

cloned project from github. heroku does not work

I cloned a project from github over to my desktop. I used to work on it form my laptop.
However, on laptop heroku does not seem to work for this app eventhough i have it installed.
First problem:
heroku open
>No app specified.
>Run this command from app folder or set it adding --app <app name>
I did not have to specify the --app on my laptop. Because I guess I did command heroku create initially on the lapop.
Second Probelm:
git push heroku master
gives errors
fatal: 'heroku' does not appear to be a git repository
fatal: The remote end hung up unexpectedly
and heroku list
says
! This version of the heroku gem has been deprecated.
! Please update it by running: gem update heroku
First do:
git remote add heroku git#heroku.com:{my-project-name}.git
Where you replace {my-project-name} with the name of the Heroku application as it appears in your Heroku account. For example, if your Heroku account says you have an application named flowing-water-397, then the line would be:
git remote add heroku git#heroku.com:flowing-water-397.git
Then Git and the Heroku gem will know that this Git repo is connected to a Heroku.com application. Then you can do things such as:
git push heroku master
heroku open
Finally, learn a little bit more about Git Remotes.
In addition to the git remote add ... that #Justice mentioned, I also needed to run
git config heroku.remote heroku
(solution found here)
I believe I get the error No app specified. Run this command from an app folder or specify which app to use with --app when I run any ambiguous heroku commands. Example:
heroku logs
It's ambiguous because I have multiple remote repositories specified in my project's .git/config file. The solution for me is simply to specify the remote repository. Example:
heroku logs --remote staging
In the above line --remote staging corresponds to the following in my project's .git/config file:
[remote "staging"]
url = git#heroku.accountname:foo-bar-1234.git
fetch = +refs/heads/*:refs/remotes/staging/*
I hope this helps you.. if not, then perhaps it may help someone else!
When I had this issue it was because I created more than one remote app on heroku.
To remove an existing remote app from heroku use:
git remote rm heroku
then go back and use heroku create to start the process over using the correct app name heroku gives you.
Solution found here:
solution

Resources