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
|
||||
import environ
|
||||
import os
|
||||
import dj_database_url
|
||||
|
||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
@ -89,26 +90,14 @@ WSGI_APPLICATION = 'config.wsgi.application'
|
||||
# Database
|
||||
# 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 = {
|
||||
'default': {
|
||||
'POOL_OPTIONS' : {
|
||||
'POOL_SIZE': 200,
|
||||
'MAX_OVERFLOW': 10,
|
||||
'RECYCLE': 24 * 60 * 60
|
||||
}
|
||||
}
|
||||
}
|
||||
'default': dj_database_url.config(
|
||||
default=f'postgis://{env("POSTGRES_USER")}:{env("POSTGRES_PASS")}@{env("PG_HOST")}:{env("PG_PORT")}/{env("POSTGRES_DBNAME")}',
|
||||
conn_max_age=600,
|
||||
conn_health_checks=True,
|
||||
)
|
||||
}
|
||||
|
||||
# Password validation
|
||||
# https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators
|
||||
|
||||
@ -64,4 +64,4 @@ urllib3==1.26.7
|
||||
django-extra-fields==3.0.2
|
||||
django-phonenumber-field==6.1.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