Skip to content

Commit

Permalink
feat(db): remove db conn pool
Browse files Browse the repository at this point in the history
  • Loading branch information
OrenZhang committed Dec 29, 2024
1 parent 4df6504 commit 6f4b824
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .cruft.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"template": "https://github.com/OVINC-CN/DevTemplateDjango.git",
"commit": "9a6da21eb67f025defc444bb99d6cd48142d2aad",
"commit": "1e0028fba6cb111a2ef69038ca07ac74fc95a219",
"checkout": "main",
"context": {
"cookiecutter": {
Expand Down
12 changes: 4 additions & 8 deletions entry/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@

# Hosts
BACKEND_URL = getenv_or_raise("BACKEND_URL")
ALLOWED_HOSTS = [getenv_or_raise("BACKEND_HOST")]
ALLOWED_HOSTS = getenv_or_raise("ALLOWED_HOSTS").split(",")
CORS_ALLOW_CREDENTIALS = strtobool(os.getenv("CORS_ALLOW_CREDENTIALS", "True"))
CORS_ORIGIN_WHITELIST = [getenv_or_raise("FRONTEND_URL")]
CSRF_TRUSTED_ORIGINS = [getenv_or_raise("FRONTEND_URL")]
CORS_ORIGIN_WHITELIST = getenv_or_raise("CORS_ORIGIN_WHITELIST").split(",")
CSRF_TRUSTED_ORIGINS = CORS_ORIGIN_WHITELIST
FRONTEND_URL = getenv_or_raise("FRONTEND_URL")

# APPs
Expand Down Expand Up @@ -95,18 +95,14 @@
# DB and Cache
DATABASES = {
"default": {
"ENGINE": "dj_db_conn_pool.backends.mysql",
"ENGINE": "django.db.backends.mysql",
"NAME": getenv_or_raise("DB_NAME"),
"USER": getenv_or_raise("DB_USER"),
"PASSWORD": getenv_or_raise("DB_PASSWORD"),
"HOST": getenv_or_raise("DB_HOST"),
"PORT": int(getenv_or_raise("DB_PORT")),
"CONN_MAX_AGE": int(os.getenv("DB_CONN_MAX_AGE", str(60 * 60))),
"OPTIONS": {"charset": "utf8mb4"},
"POOL_OPTIONS": {
"POOL_SIZE": int(os.getenv("DB_POOL_SIZE", "10")),
"MAX_OVERFLOW": int(os.getenv("DB_POOL_MAX_OVERFLOW", "0")),
},
}
}
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
Expand Down
3 changes: 2 additions & 1 deletion env.example
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
APP_CODE=iwiki-api
APP_SECRET=iwiki-api
BACKEND_URL=https://dev-api.example.com
BACKEND_HOST=dev-api.example.com
ALLOWED_HOSTS=dev-api.example.com
FRONTEND_URL=https://dev.example.com
CORS_ORIGIN_WHITELIST=https://dev.example.com
DB_NAME=iwiki-api
DB_USER=iwiki-api
DB_PASSWORD=
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ovinc
ovinc-client==0.3.15
ovinc-client==0.3.16

# Celery
celery==5.4.0
Expand Down

0 comments on commit 6f4b824

Please sign in to comment.