将rails应用程序推送到heroku时遇到了一些麻烦。
我有错误
无法通过Bundler安装gem。 远程:!检测到Heroku不支持的sqlite3 gem: 远程:! https://devcenter.heroku.com/articles/sqlite3
所以我按照链接上的说明操作,但是,我仍然有同样的错误。我试图看看其他类似的主题,但仍然没有工作......
有什么想法吗?
更新 这是我的gemfile的样子:
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
# Adds support for Capybara system testing and selenium driver
gem 'capybara', '~> 2.13'
gem 'selenium-webdriver'
gem 'web-console', '>= 3.3.0'
gem 'listen', '>= 3.0.5', '< 3.2'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
gem 'sqlite3'
end
group :production do
gem 'pg'
end
答案 0 :(得分:3)
虽然易于使用,但SQLite并非用作生产级数据库。相反,Heroku提供生产级PostgreSQL数据库作为服务。
不要在heroku上使用sqlite - 确保您在sqlite3
的全局范围或:production
组中没有Gemfile
gem。
答案 1 :(得分:0)
使用sqlite3进行单元测试和开发环境很好但是在生产中你会想要使用像PostgreSQL这样的东西。
以下是您的Gemfile的样子:
group :test, :development do
gem 'sqlite3'
end
group :production do
gem 'pg'
end
另外,如果您正在编写单元测试,则应将sqlite3数据库URL设置为sqlite::memory:
以进行单元测试,而不是实际的数据库。