[英]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 我已经为root创建了一个自定义页面,并在routes.rb中进行了相应的更改。我在使用git之前删除了public / index.html文件但该应用程序仍然在heroku中查找public / index.html文件。该应用程序在本地工作正常但是问题是在heroku中部署。请建议一些解决方案?我的Gemfile包含
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. 我没有在我的应用程序中使用数据库。控制器只是对json字符串进行一些计算。
I believe you have used: 我相信你曾经用过:
git add .
git commit -m "blabla"
However, git add .
但是,
git add .
don't look for deleted files, so the public/index.html
is still there. 不要查找已删除的文件,因此
public/index.html
仍然存在。
You must use git add -u
to include the removed files. 您必须使用
git add -u
来包含已删除的文件。
Or, you can use git add -A
, which is is equivalent to git add .
或者,你可以使用
git add -A
,这相当于git add .
plus git add -u
. 再加上
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. 如果您删除了
public/index.html
文件,则必须正常工作。
EDIT add the following to your gemfile: 编辑将以下内容添加到您的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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.