Django: Deploying an application on Heroku with sqlite3 as the database(Django:使用 sqlite3 作为数据库在 Heroku 上部署应用程序)
问题描述
我想在 Heroku 上部署一个使用 sqlite3 作为数据库的应用程序.但是,似乎 Heroku 不支持使用 sqlite3 作为数据库的应用程序.这是真的吗?有没有办法在 Heroku 上部署我的 sqlite3 支持的应用程序?
I want to deploy an application with sqlite3 as the database on Heroku. However, it seems to be that Heroku doesn't support applications with sqlite3 as the database. Is it true? Is there no way to deploy my sqlite3-backed application on Heroku?
PS:我已经使用 PythonAnywhere 成功部署了我的应用程序,但现在想知道是否有任何可能的方式使用 Heroku 部署它.
PS: I have successfully deployed my application using PythonAnywhere, but would now like to know whether there's any possible way to deploy it using Heroku.
推荐答案
由于 Heroku 的 dynos 没有跨部署持续存在的文件系统,因此 SQLite3 等基于文件的数据库将不适合.不过,对于开发/快速原型来说,这是一个很棒的数据库.
As Heroku's dynos don't have a filesystem that persists across deploys, a file-based database like SQLite3 isn't going to be suitable. It's a great DB for development/quick prototypes, though.
Heroku do 有 一个 Postgres 产品,但是它适合 - 带有免费套餐和每月 9 美元的基本套餐,适合业余爱好/小型项目.与 SQLite 相比,最大的好处是您可以获得其他方式无法获得的备份(以及所有其他 Postgres 功能).
Heroku do have a Postgres offering however that will suit - with a free tier and a basic $9/month tier that are good for hobby/small projects. The biggest benefit over SQLite is that you get backups that you wouldn't get otherwise (plus all the other Postgres features).
这里有更新 settings.py
以使用 Postgres 的指南:https://devcenter.heroku.com/articles/getting-started-with-django#django-settings
There's a guide to updating your settings.py
to use Postgres here: https://devcenter.heroku.com/articles/getting-started-with-django#django-settings
这篇关于Django:使用 sqlite3 作为数据库在 Heroku 上部署应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Django:使用 sqlite3 作为数据库在 Heroku 上部署应用程序


- 以一个值为轴心,但将一行上的数据按另一行分组? 2022-01-01
- SQL 临时表问题 2022-01-01
- 更改自动增量起始编号? 2021-01-01
- 在SQL中,如何为每个组选择前2行 2021-01-01
- 远程 mySQL 连接抛出“无法使用旧的不安全身份验证连接到 MySQL 4.1+"来自 XAMPP 的错误 2022-01-01
- 如何将 Byte[] 插入 SQL Server VARBINARY 列 2021-01-01
- 导入具有可变标题的 Excel 文件 2021-01-01
- 如何将 SonarQube 6.7 从 MySQL 迁移到 postgresql 2022-01-01
- 如何使用 pip 安装 Python MySQLdb 模块? 2021-01-01
- 使用 Oracle PL/SQL developer 生成测试数据 2021-01-01