简体   繁体   English

Rails在本地工作正常,但在heroku中没有

[英]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.

相关问题 “ rails服务器”未在本地看到rails项目,在heroku上工作正常 - “rails server” not seeing rails project locally which works fine on heroku heroku 上的 Rails 未初始化常量错误,twitter api,在本地工作正常 - Rails uninitialized constant error on heroku, twitter api, works fine locally Rails应用程序在本地运行良好,但heroku给出“应用程序错误” - Rails app works fine locally but heroku gives “application error” 在heroku上部署Rails应用程序时遇到问题(该应用程序在本地运行良好)? - Having issues with deploying Rails app on heroku( app works fine locally)? 带有Yummly Gem的Rails在本地运行良好,但在Heroku上无法正常运行 - Rails with Yummly Gem works fine locally, but fails on Heroku 控制器可以在本地正常运行,但不能在heroku上运行 - Controller works fine locally but not on heroku Rails代码在本地工作,但不在Heroku上工作 - Rails code works locally but not on Heroku Rails.present? 在本地工作,但不适用于Heroku - Rails .present? works locally but not on Heroku Rails 4-应用程序可在本地运行,但不能在Heroku上运行 - Rails 4 - App works locally, but not on Heroku Heroku:Rails应用程序可在本地运行,但在Heroku上崩溃 - Heroku: Rails app works locally but crashes on heroku
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM