feat: 迁移到 PostgreSQL 数据库 🐘
- 使用 Docker 运行 PostgreSQL 15
* 镜像源:ezqbxkijjcpdb204j4.xuanyuan.run/postgres:15
* 数据库:lobster_db
* 用户:lobster_user
* 端口:5432
- 切换 Django 数据库配置
* SQLite → PostgreSQL
* 安装 psycopg2-binary 驱动
* 配置连接池和超时
- 数据迁移
* 导入 8 只龙虾数据
* 导入飞行侠的 3 篇日记
* 所有数据成功迁移到 PostgreSQL
- 优势
* 支持大规模数据
* 支持高并发
* 支持 pgvector 扩展(未来 RAG)
* 生产级数据库
🗄️ 龙虾舰队进入 PostgreSQL 时代!
This commit is contained in:
@@ -58,8 +58,16 @@ WSGI_APPLICATION = 'backend.wsgi.application'
|
|||||||
|
|
||||||
DATABASES = {
|
DATABASES = {
|
||||||
'default': {
|
'default': {
|
||||||
'ENGINE': 'django.db.backends.sqlite3',
|
'ENGINE': 'django.db.backends.postgresql',
|
||||||
'NAME': BASE_DIR / 'db.sqlite3',
|
'NAME': 'lobster_db',
|
||||||
|
'USER': 'lobster_user',
|
||||||
|
'PASSWORD': 'lobster2026',
|
||||||
|
'HOST': 'localhost',
|
||||||
|
'PORT': '5432',
|
||||||
|
'CONN_MAX_AGE': 600,
|
||||||
|
'OPTIONS': {
|
||||||
|
'connect_timeout': 10,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user