在heroku上部署sqlite db的Django网站

2023-10-09数据库问题
4

本文介绍了在heroku上部署sqlite db的Django网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我在很多地方都读到过 Heroku 不支持 sqlite 数据库.没有使用sqlite的选项吗?是否有任何类型的包装器或插件与 sqlite 一起使用,以便它可以部署在 Heroku 中?任何人都可以共享资源或指南来完成相同的端到端操作吗?

I have been reading at many places that Heroku doesn't support sqlite database. Is there no option to use sqlite? Is there any kind of wrapper or plug-in to be used with sqlite so that it can be deployed in Heroku? Can anyone share resources or guides to do the same end to end?

推荐答案

不,没有办法做到这一点.sqlite 数据库是磁盘上的文件,但 Heroku 上的文件系统是短暂的,并且不会在 dynos 之间共享,因此每次部署时都会丢失数据库.

No, there is no way to do this. An sqlite database is a file on disk, but the filesystem on Heroku is ephemeral and not shared between dynos, so the db would be lost every time you deploy.

但是没有理由去尝试.Django 已经抽象出数据库之间的所有差异以供常规使用.Heroku 支持许多针对不同用例的 Postgres 计划,包括免费的爱好层.

But there is no reason to try. Django already abstracts away all the differences between databases for regular usage. Heroku supports a number of Postgres plans for different use cases, including a free hobby tier.

这篇关于在heroku上部署sqlite db的Django网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

SQL 子句“GROUP BY 1"是什么意思?意思是?
What does SQL clause quot;GROUP BY 1quot; mean?(SQL 子句“GROUP BY 1是什么意思?意思是?)...
2024-04-16 数据库问题
62

如何在MySQL中为每个组选择第一行?
How to select the first row for each group in MySQL?(如何在MySQL中为每个组选择第一行?)...
2024-04-16 数据库问题
13

MySQL - 获取最低值
MySQL - Fetching lowest value(MySQL - 获取最低值)...
2024-04-16 数据库问题
8

Django MySQLdb 版本与 _mysql 版本 Ubuntu 不匹配
Django MySQLdb version doesn#39;t match _mysql version Ubuntu(Django MySQLdb 版本与 _mysql 版本 Ubuntu 不匹配)...
2024-04-16 数据库问题
11

mySQL init 脚本未与 docker-compose 一起运行
mySQL init scripts not running with docker-compose(mySQL init 脚本未与 docker-compose 一起运行)...
2024-04-16 数据库问题
14

在 cmakelist.txt 中添加和链接 mysql 库
Add and link mysql libraries in a cmakelist.txt(在 cmakelist.txt 中添加和链接 mysql 库)...
2024-04-16 数据库问题
41