Heroku deployment failed because of sqlite3 gem error

后端 未结 5 1818
太阳男子
太阳男子 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 13:57

    On Heroku, your app doesn't have access to the filesystem. There's a number of reasons for this - it's basically due to the fact that you can scale your app's performance by adding new instances (i.e. running multiple servers at once), and these instances aren't guaranteed to be on the same physical machine - copying the files across would be extremely slow.

    SQLite just stores the database to a file in your db/ folder, which is why it's incompatible with Heroku.

    The best option, as suggested in the help link, is to move away from SQLite, because there are sometimes subtle incompatibilities between SQLite and PostgreSQL (Heroku's database of choice) and you want to find this out before you deploy to production!

    After you install PostgreSQL (exactly how to do this depends on your OS) and then add gem 'pg' to your Gemfile.

提交回复
热议问题