I'm trying to deploy my first app to Heroku. I'm using SQLite as the database. As far as I know Heroku doesn't use SQLite - it switches to Postgres in the backend.
When I'm deploying I get the following error:
/usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/runtime.rb:64:in `require': no such file to load -- sqlite3 (LoadError)
My Gemfile
(which is what I assume is causing this problem) looks as follows:
source 'http://rubygems.org'
gem 'rails', '3.0.0'
gem 'sqlite3-ruby', '1.2.5', :require => 'sqlite3'
What am I doing wrong?
Heroku doesn't support SQLite databases. You need to use PostgreSQL on production, as I also explained in this post.
Actually, it's recommended to use in development/test an environment as close as possible to production. Therefore, I suggest you to switch all your environments to PostgreSQL.
I'm using sqlite3 and deploy to Heroku no problem. Here is my database.yml
After banging my head against this problem, I realized I was pushing the master branch of my repo to heroku, while I was making all of my postgres changes in my deploy-postgres branch of my repo!
I merged my deploy-postgres branch with my local master [
git checkout master; git merge deploy-postgres
] and then could rungit push heroku master
as per the heroku documentation.I was stuck on this for hours looking at every answer here, but I couldn't get enough details to make it come together. This paged walked me through everything. http://railsapps.github.io/rails-heroku-tutorial.html
Good luck.
You can use clearDB addon
and
gem 'mysql2'
instead ofgem 'sqlite3'
Simone Carletti is correct and so is Joost. You only need to group the sqlite3 gem or remove it entirely from your Gemfile. Heroku just needs to know that you don't want to use sqlite3 for production
So this:
Or this:
If you remove the reference entirely you will probably mess up your local db though