Heroku deployment failed because of sqlite3 gem error

后端 未结 5 1817
太阳男子
太阳男子 2020-11-28 13:45

I just started the ruby.railstutorial.org book by Michael Hartl and have been working through the first chapter. I am using mac book OS X, Terminal, and Sublime Text. Every

5条回答
  •  时光取名叫无心
    2020-11-28 14:00

    Heroku do not support sqlite3...

    Remove sqlite3 from your Gemfile, use pg gem instead. Do following change in gem file

    change following in your Gemfile

    gem 'sqlite3'
    

    to

    gem 'pg' #you will have to install postgresql
    

    Important: Run

    git add .
    git commit 
    git push heroku master
    

    Note: If you are planning to deploy for heroku, I suggest it is better to use postgres in your development phase also(install postgresql in your computer), heroku prefer psql.

    If you want to use sqllite for development and postgresql for Heroku, use following config.

    group :development do 
       gem 'sqlite3'    #gem to use in development environment
    end
    
    group :production do 
      gem 'pg'         #gem to use in production environment
    end
    

    Heroku will use pg gem since heroku run your application in production enviroment

提交回复
热议问题