Skip to content

Commit 51dc95e

Browse files
committed
Add persistent connections and health checks using database config.
1 parent 397ac26 commit 51dc95e

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

djangosnippets/settings/base.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,12 @@ def user_url(user):
178178
}
179179

180180

181-
DATABASES = {"default": dj_database_url.config(default="postgres:///djangosnippets")}
181+
DATABASES = {
182+
"default": dj_database_url.config(
183+
conn_max_age=600,
184+
conn_health_checks=True,
185+
)
186+
}
182187
DATABASES["default"]["ATOMIC_REQUESTS"] = True
183188

184189

requirements/base.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
bleach==6.2.0
22
Django==5.2.3
3-
dj-database-url==0.5.0
3+
dj-database-url==3.0.0
44
django-allauth==0.63.6
55
django-contrib-comments==2.2.0
66
django-extensions==3.2.3

0 commit comments

Comments
 (0)