Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

do not use conn_max_age if chosen Django version >= 5.1 #322

Merged
merged 1 commit into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions src/django_twc_project/{{ module_name }}/settings.py.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down