Skip to content
Closed
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 django_mongodb_backend/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ def get_connection_params(self):
settings_dict = self.settings_dict
if not settings_dict["NAME"]:
raise ImproperlyConfigured('settings.DATABASES is missing the "NAME" value.')
# Use persistent connections by default, even if the user specifies
# CONN_MAX_AGE=0. (This code has no way to distinguish that case.)
if settings_dict["CONN_MAX_AGE"] == 0:
settings_dict["CONN_MAX_AGE"] = None
return {
"host": settings_dict["HOST"] or None,
"port": int(settings_dict["PORT"] or 27017),
Expand Down