Skip to content

Commit

Permalink
Merge pull request #134 from uktrade/database-config-test
Browse files Browse the repository at this point in the history
Attempt at database config change
  • Loading branch information
gdbarnes authored Dec 13, 2024
2 parents 4ed15d2 + 6e24b7f commit 373d9ae
Showing 1 changed file with 29 additions and 17 deletions.
46 changes: 29 additions & 17 deletions fbr/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@

WSGI_APPLICATION = "fbr.wsgi.application"

DATABASES: dict = {}
DATABASES: dict = {"default": {}}

# We're going to restructure the below so that we don't end up with
# a sqlite database in production.
Expand All @@ -121,23 +121,35 @@
# default=database_url_from_env("DATABASE_CREDENTIALS")
# )

if DATABASE_URL := env("DATABASE_URL", default=None):
DATABASES = {
"default": {
**dj_database_url.parse(
DATABASE_URL,
engine="postgresql",
),
"ENGINE": "django.db.backends.postgresql",
}
}
# if DATABASE_URL := env("DATABASE_URL", default=None):
# DATABASES = {
# "default": {
# **dj_database_url.parse(
# DATABASE_URL,
# engine="postgresql",
# ),
# "ENGINE": "django.db.backends.postgresql",
# }
# }
# else:
# DATABASES = {
# "default": {
# "ENGINE": "django.db.backends.sqlite3",
# "NAME": BASE_DIR / "db.sqlite3",
# }
# }

if DATABASE_URL := env("DATABASE_CREDENTIALS", default=None):
DATABASES["default"] = dj_database_url.config(
default=database_url_from_env("DATABASE_CREDENTIALS")
)
DATABASES["default"]["ENGINE"] = "django.db.backends.postgresql"
else:
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": BASE_DIR / "db.sqlite3",
}
}
DATABASES["default"] = dj_database_url.parse(
"",
engine="postgresql",
)
DATABASES["default"]["ENGINE"] = "django.db.backends.postgresql"


AUTH_PASSWORD_VALIDATORS = [
Expand Down

0 comments on commit 373d9ae

Please sign in to comment.