File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change 4040# --------------------------------------------------------------------------
4141DATABASES ["default" ] = env .db () # Raises ImproperlyConfigured if DATABASE_URL not set
4242
43+ # Enable database connection pooling
44+ # https://docs.djangoproject.com/en/dev/ref/databases/#connection-pool
45+ USE_DB_POOLING = env .bool ("USE_DB_POOLING" , default = False )
4346for db in ("default" , "replica" ):
4447 if db in DATABASES :
45- # Enable database connection pooling
46- # https://docs.djangoproject.com/en/dev/ref/databases/#connection-pool
4748 if "OPTIONS" not in DATABASES [db ]:
4849 DATABASES [db ]["OPTIONS" ] = {}
49- if DATABASES [db ]["ENGINE" ] == "django.db.backends.postgresql" :
50+
51+ if (
52+ DATABASES [db ]["ENGINE" ] == "django.db.backends.postgresql"
53+ and USE_DB_POOLING
54+ ):
5055 DATABASES [db ]["OPTIONS" ]["pool" ] = True
5156 else :
5257 # CONN_MAX_AGE should be 0 when using connection pooling
You can’t perform that action at this time.
0 commit comments