簡體   English   中英

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

[英]Rails works fine locally but not in heroku

我已經為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'

我沒有在我的應用程序中使用數據庫。控制器只是對json字符串進行一些計算。

我相信你曾經用過:

git add .
git commit -m "blabla"

但是, git add . 不要查找已刪除的文件,因此public/index.html仍然存在。

您必須使用git add -u來包含已刪除的文件。

或者,你可以使用git add -A ,這相當於git add . 再加上git add -u

編輯 - 一步一步評論:

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

如果您刪除了public/index.html文件,則必須正常工作。

編輯將以下內容添加到您的gemfile:

group :production do
  gem 'pg'
end

比:

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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM