Skip to content

Commit

Permalink
Attempt as database config change
Browse files Browse the repository at this point in the history
  • Loading branch information
gdbarnes committed Dec 13, 2024
1 parent 8dc9968 commit 6e24b7f
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 6e24b7f

Please sign in to comment.