feat: using mysql/mariadb

This commit is contained in:
2025-09-20 23:54:49 +08:00
parent 82970de48e
commit 67ef0ddd63
4 changed files with 28 additions and 1 deletions
+4
View File
@@ -0,0 +1,4 @@
# import pymysql
#
# pymysql.install_as_MySQLdb()
# 如果不使用 sqlitedb 就取消上面两行注释
+10 -2
View File
@@ -8,6 +8,14 @@
"EMAIL_USE_SSL": true,
"DEFAULT_FROM_EMAIL": "",
"ADMINS": [["", ""]]
}
}
},
"DATABASE": {
"ENGINE": "填 MariaDB 或 MySQL",
"NAME": "数据库名",
"USER": "用户",
"PASSWORD": "密码",
"HOST": "主机ip/域名",
"PORT": 3306
}
}
+15
View File
@@ -89,6 +89,7 @@ ASGI_APPLICATION = "item_manager.asgi.application"
# Database
# https://docs.djangoproject.com/en/5.2/ref/settings/#databases
# SQLite 配置
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
@@ -96,6 +97,20 @@ DATABASES = {
}
}
# 读取数据库配置
# DB_SECURE = SECURE.get("DATABASE", {}) if isinstance(SECURE, dict) else {}
#
# DATABASES = {
# "default": {
# "ENGINE": "django.db.backends.mysql",
# "NAME": DB_SECURE.get("NAME"),
# "USER": DB_SECURE.get("USER"),
# "PASSWORD": DB_SECURE.get("PASSWORD"),
# "HOST": DB_SECURE.get("HOST"),
# "PORT": DB_SECURE.get("PORT"),
# }
# }
# Password validation
# https://docs.djangoproject.com/en/5.2/ref/settings/#auth-password-validators
Binary file not shown.