将应用程序部署到Heroku
问题描述:
当我想将我的应用程序部署到heroku(使用git push heroku master)时,它给了我一个错误,并告诉我安装sqlite3 -v'1.3.6'。因此,成功安装该宝石后,我试着再次部署到heroku,它仍然给我同样的错误!不过,我已经安装了它。现在我甚至无法在本地运行我的rails项目(rails服务器)。我可以知道这可能是什么原因吗?将应用程序部署到Heroku
这是我在database.yml文件内容:
# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
adapter: sqlite3
database: db/test.sqlite3
pool: 5
timeout: 5000
production:
adapter: sqlite3
database: db/production.sqlite3
pool: 5
timeout: 5000
答
Heroku的不SQLite3
工作打开你的Gemfile并更换线:
gem 'sqlite3'
为
group :production do
gem 'pg'
end
group :development, :test do
gem 'sqlite3'
end
我也建议你阅读Heroku的说明:https://devcenter.heroku.com/articles/rails3
+0
这样做的窍门!谢谢!虽然现在我又遇到了另外一个问题:“我们很抱歉,但出了问题”哈哈哈!这是另一个问题,但是非常感谢您解决这个问题!:D – user1480797 2012-07-17 18:03:58
答
让你的Gemfile看起来像这样
group :production do
gem 'pg'
end
group :development, :test do
gem 'sqlite3-ruby', :require => 'sqlite3'
end
你做了一个捆绑安装?并可以发布您的database.yml文件 – 2012-07-17 16:21:01
yeap ..现在我得到了错误:“找不到RubyGem Bundler ......”这是非常奇怪的,因为我一直在使用Rails一个月,没有遇到任何问题! :(无论如何,我已经在qn – user1480797 2012-07-17 16:26:29
中发布了dataabase.yml文件,所以,heroku使用postgres,因此在您的gemfile中将sqlite gem放入组中:开发do – 2012-07-17 16:26:33