Skip to content

Commit

Permalink
refactor DATABASES configuration in settings.py for cleaner structure…
Browse files Browse the repository at this point in the history
… and better readability
  • Loading branch information
AlexTraveylan committed Sep 9, 2024
1 parent ec44fc9 commit 7ba1b43
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions TaskEqualizer/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,24 +97,24 @@
SUPABASE_DBNAME = os.getenv("SUPABASE_DBNAME")
SUPABASE_PASSWORD = os.getenv("SUPABASE_PASSWORD")

if PRODUCTION is True:
DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql",
"NAME": SUPABASE_DBNAME,
"USER": SUPABASE_USER,
"PASSWORD": SUPABASE_PASSWORD,
"HOST": SUPABASE_HOST,
"PORT": SUPABASE_PORT,
}
}
else:
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": BASE_DIR / "db.sqlite3",
}
# if PRODUCTION is True:
DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql",
"NAME": SUPABASE_DBNAME,
"USER": SUPABASE_USER,
"PASSWORD": SUPABASE_PASSWORD,
"HOST": SUPABASE_HOST,
"PORT": SUPABASE_PORT,
}
}
# else:
# DATABASES = {
# "default": {
# "ENGINE": "django.db.backends.sqlite3",
# "NAME": BASE_DIR / "db.sqlite3",
# }
# }


# Password validation
Expand Down

0 comments on commit 7ba1b43

Please sign in to comment.