Is it possible to deploy Django with Sqlite?

前端 未结 3 1664
慢半拍i
慢半拍i 2021-01-28 05:49

I\'ve built a Django app that uses sqlite (the default database), but I can\'t find anywhere that allows deployment with sqlite. Heroku only works with postgresql, and I\'ve sp

3条回答
  •  无人共我
    2021-01-28 06:19

    Don't use SQLite on heroku. As stated in the docs you will lose your data:

    SQLite runs in memory, and backs up its data store in files on disk. While this strategy works well for development, Heroku’s Cedar stack has an ephemeral filesystem. You can write to it, and you can read from it, but the contents will be cleared periodically. If you were to use SQLite on Heroku, you would lose your entire database at least once every 24 hours.

    Even if Heroku’s disks were persistent running SQLite would still not be a good fit. Since SQLite does not run as a service, each dyno would run a separate running copy. Each of these copies need their own disk backed store. This would mean that each dyno powering your app would have a different set of data since the disks are not synchronized.

    Instead of using SQLite on Heroku you can configure your app to run on Postgres.

提交回复
热议问题