App pushed to heroku still shows standard index page
When you're using git and delete a file, that file is not automatically removed from the git repo. So when you git push heroku
the file still exists and gets pushed to Heroku.
You can tell if this is the case with git status
, which will show something like:
# Changes not staged for commit:
# (use "git add/rm <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# deleted: public/index.html
In order to remove the file, you need to use git rm
. In this case you need to do something like:
git rm public/index.html
git commit -m "Removed public/index.html"
which will remove the file from the current branch.
Now when you do
git push heroku
the file won't be included, and so you'll be routed to the controller as specified in routes.rb.
App pushed to heroku still shows standard index page
When you're using git and delete a file, that file is not automatically removed from the git repo. So when you git push heroku
the file still exists and gets pushed to Heroku.
You can tell if this is the case with git status
, which will show something like:
# Changes not staged for commit:
# (use "git add/rm <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# deleted: public/index.html
In order to remove the file, you need to use git rm
. In this case you need to do something like:
git rm public/index.html
git commit -m "Removed public/index.html"
which will remove the file from the current branch.
Now when you do
git push heroku
the file won't be included, and so you'll be routed to the controller as specified in routes.rb.
deploying to heroku -- can't get rid of the welcome to rails default page
Did you make sure to remove public/index.html from your git repo that you're pushing as well?
git rm public/index.html
git add -u
git commit -m "Removed index.html"
Heroku Still Displays Default Rails Home Page
Did you try clearing the cache in your browser and reloading? The index.html
file may still be in cache there.
Why is only home page on my website showing when deployed on heroku?
The routes in your navbar and the routes defined in your file are different.
This route
get 'handm/about'
Creates a url at your_app_name/handm/about
If you just want your_app_name/about, which is the link in the navbar, then change it to this in your route file.
get 'about', to: 'handm#about'
What this does is it names the route /about and points it to your controller and action with "to: handm#about". You will need to switch over each of the routes in this way, not the root through, leave that as is.
When you switch that over, push to git and redeploy to heroku your links should work as is.
Part of my website not rendering when pushed to heroku
You've generated your build
folder once. You've since done changes to your code but haven't generated a new build.
const express = require("express");
const app = express();
const port = process.env.port || 5000
app.use(express.static(path.join(__dirname, 'build')));
app.get('/*', (req, res) => {
res.sendFile(path.join(__dirname, 'build', 'index.html'));
});
app.listen(port, () => console.log(`Server started on port: ${port}`));
here you can see that you are only serving the content which is in your build folder. It hasn't changed.
Go into your clients folder and execute npm build
and move the generated build files into /build
.
heroku not updating after I git push
Deleting the default Rails homepage isn't enough, you have to instruct git to remove all deleted files. This is the command I use:
git add .
git commit -am "save all changed files & remove deleted ones"
git push heroku master
Other commands that should work:
git add . -A
git commit -m "..."
git add -u
git commit -m "..."
Note that if you delete files before doing any commits then git can't add them.
react-create-app heroku not running app
You have to build react app before deploying to heroku.
There is a tool to automate this process
create-react-app-buildpack
The steps required are following
heroku create $APP_NAME --buildpack https://github.com/mars/create-
react-app-buildpack.git
git add .
git commit -m "Start with create-react-app"
git push heroku master
heroku open
Unable to deploy static website to heroku, html and css not loading from php
Instead of using:
<?php include_once("home.html"); ?>
this worked perfectly
<?php include_once("./home.html"); ?>
Related Topics
Accessing Ruby Class Variables with Class_Eval and Instance_Eval
Resque Multiple Workers in Development Mode
How to Render a Partial in Sinatra View (Haml in Haml)
How Might I Pass Text Data from the Ruby Console into My Clipboard Without Saving to a File
Rails: Respond_To JSON and HTML
Carrierwave: Create the Same, Unique Filename for All Versioned Files
Rails 3.2.2 (Or 3.2.1) + Postgresql 9.1.3 + Ubuntu 11.10 Connection Error
What Does the % Operator Do in Ruby in N % 2
How to Get All Field Names of the Mongoid Document
Runtime Changing Model with Mongodb/Mongoid
How to Structure a Layout Template in Haml
Deleting Table from Schema - Rails
How to Call Applicationcontroller Methods from Applicationhelper
How Does Rails Implement Before_Filter
What's the Difference Between a Class and the Singleton of That Class in Ruby