Skip to content

Commit e528122

Browse files
committed
use POD_INSTANCE env instead of hostname for the default database name
1 parent b87987d commit e528122

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

pod/main/settings.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"""
66

77
import os
8-
import socket
98

109
##
1110
# flatpages
@@ -81,11 +80,11 @@
8180
# to be used with Django.
8281
#
8382
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases
84-
hostname = socket.gethostname()
83+
default_db = "db.{instance}.sqlite3".format(instance=os.environ["POD_INSTANCE"]) if os.getenv("POD_INSTANCE") else "db.sqlite3"
8584
DATABASES = {
8685
"default": {
8786
"ENGINE": "django.db.backends.sqlite3",
88-
"NAME": os.path.join(BASE_DIR, f"db.{hostname}.sqlite3"),
87+
"NAME": os.path.join(BASE_DIR, default_db),
8988
}
9089
}
9190

0 commit comments

Comments
 (0)