diff --git a/CHANGELOG.md b/CHANGELOG.md index c53e164..0cc4f90 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [Unreleased] +### Fixed + +- Removed `conn_max_age` argument when configuring database connection if Django version is greater than 5.1. In that case, we enable connection pooling and the `conn_max_age` setting causes the application to error with a `django.core.exceptions.ImproperlyConfigured: Pooling doesn't support persistent connections.` exception. + ## [2024.50] ### Added diff --git a/src/django_twc_project/{{ module_name }}/settings.py.jinja b/src/django_twc_project/{{ module_name }}/settings.py.jinja index 238d21a..36c45a4 100644 --- a/src/django_twc_project/{{ module_name }}/settings.py.jinja +++ b/src/django_twc_project/{{ module_name }}/settings.py.jinja @@ -70,7 +70,9 @@ DATABASES = { "default": env.dj_db_url( "DATABASE_URL", default="sqlite:///db.sqlite3", +{%- if django_version >= "5.1" %} conn_max_age=600, # 10 minutes +{%- endif %} conn_health_checks=True, ssl_require=( # Crunchy Bridge DBs require SSL connections @@ -86,7 +88,9 @@ DATABASES = { EMAIL_RELAY_DATABASE_ALIAS: env.dj_db_url( "EMAIL_RELAY_DATABASE_URL", default="sqlite:///email_relay.sqlite3", +{%- if django_version >= "5.1" %} conn_max_age=600, # 10 minutes +{%- endif %} conn_health_checks=True, ssl_require=( PROD