简体   繁体   中英

Rails works fine locally but not in heroku

I have created a custom page for root and changed accordingly in routes.rb.I have removed the public/index.html file before using git but the app still looks for public/index.html file in heroku.The app works fine locally but the problem is while deploying in heroku.Please suggest some solutions?My Gemfile contains

source 'https://rubygems.org'
gem 'rails', '3.2.11'
group :development do
  gem 'sqlite3', '1.3.5'
end
group :assets do
  gem 'sass-rails','3.2.4'
  gem 'coffee-rails', '3.2.2'
  gem 'uglifier', '1.2.3'
end
gem 'jquery-rails'
gem 'thin'

and i am not using databases in my app.The controller just do some calculations on a json string.

I believe you have used:

git add .
git commit -m "blabla"

However, git add . don't look for deleted files, so the public/index.html is still there.

You must use git add -u to include the removed files.

Or, you can use git add -A , which is is equivalent to git add . plus git add -u .

edit - step by step with comments:

git add -A                #add everything (including deleted files)
git commit -m "blabla"    #commit it
git push                  #push from your pc to your git repository
git push heroku           #push from your git repository to heroku

If you have deleted the public/index.html file it must work.

EDIT add the following to your gemfile:

group :production do
  gem 'pg'
end

Than:

RAILS_ENV=production bundle exec rake assets:precompile
git add -A
git commit -m "blabla"
git push
git push heroku

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM