added DJ-pool
This commit is contained in:
@ -13,6 +13,7 @@ https://docs.djangoproject.com/en/3.2/ref/settings/
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import environ
|
import environ
|
||||||
import os
|
import os
|
||||||
|
import dj_database_url
|
||||||
|
|
||||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||||
@ -89,25 +90,13 @@ WSGI_APPLICATION = 'config.wsgi.application'
|
|||||||
# Database
|
# Database
|
||||||
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases
|
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases
|
||||||
|
|
||||||
DATABASES = {
|
|
||||||
'default': {
|
|
||||||
'ENGINE': 'dj_db_conn_pool.backends.postgresql',
|
|
||||||
'NAME': env("POSTGRES_DBNAME"),
|
|
||||||
'USER': env("POSTGRES_USER"),
|
|
||||||
'PASSWORD': env("POSTGRES_PASS"),
|
|
||||||
'HOST': env("PG_HOST"),
|
|
||||||
'PORT': env("PG_PORT")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DATABASES = {
|
DATABASES = {
|
||||||
'default': {
|
'default': dj_database_url.config(
|
||||||
'POOL_OPTIONS' : {
|
default=f'postgis://{env("POSTGRES_USER")}:{env("POSTGRES_PASS")}@{env("PG_HOST")}:{env("PG_PORT")}/{env("POSTGRES_DBNAME")}',
|
||||||
'POOL_SIZE': 200,
|
conn_max_age=600,
|
||||||
'MAX_OVERFLOW': 10,
|
conn_health_checks=True,
|
||||||
'RECYCLE': 24 * 60 * 60
|
)
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Password validation
|
# Password validation
|
||||||
|
|||||||
@ -64,4 +64,4 @@ urllib3==1.26.7
|
|||||||
django-extra-fields==3.0.2
|
django-extra-fields==3.0.2
|
||||||
django-phonenumber-field==6.1.0
|
django-phonenumber-field==6.1.0
|
||||||
django-rest-knox==4.2.0
|
django-rest-knox==4.2.0
|
||||||
django-db-connection-pool[postgresql]
|
dj-database-url==2.0.0
|
||||||
|
|||||||
Reference in New Issue
Block a user