Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert DB config #143

Merged
merged 1 commit into from
Dec 17, 2024
Merged
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
42 changes: 27 additions & 15 deletions fbr/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,24 +113,36 @@

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

if DATABASE_URL := env("DATABASE_URL", default=None):
# Use DATABASE_URL for local development if available in local.env
DATABASES["default"] = dj_database_url.parse(
DATABASE_URL,
engine="postgresql",
)
elif DATABASE_CREDENTIALS := env("DATABASE_CREDENTIALS", default=None):
# Use DATABASE_CREDENTIALS (server) for deployed environments
if DATABASE_URL := env("DATABASE_CREDENTIALS", default=None):
DATABASES["default"] = dj_database_url.config(
default=database_url_from_env(DATABASE_CREDENTIALS)
default=database_url_from_env("DATABASE_CREDENTIALS")
)
DATABASES["default"]["ENGINE"] = "django.db.backends.postgresql"
else:
# Empty configuration to allow the codebuild to run without DB config
DATABASES["default"] = dj_database_url.parse("", engine="postgresql")

# Ensure the ENGINE is set correctly
DATABASES["default"]["ENGINE"] = "django.db.backends.postgresql"

DATABASES["default"] = dj_database_url.parse(
"",
engine="postgresql",
)
DATABASES["default"]["ENGINE"] = "django.db.backends.postgresql"


# if DATABASE_URL := env("DATABASE_URL", default=None):
# # Use DATABASE_URL for local development if available in local.env
# DATABASES["default"] = dj_database_url.parse(
# DATABASE_URL,
# engine="postgresql",
# )
# elif DATABASE_CREDENTIALS := env("DATABASE_CREDENTIALS", default=None):
# # Use DATABASE_CREDENTIALS (server) for deployed environments
# DATABASES["default"] = dj_database_url.config(
# default=database_url_from_env(DATABASE_CREDENTIALS)
# )
# else:
# # Empty configuration to allow the codebuild to run without DB config
# DATABASES["default"] = dj_database_url.parse("", engine="postgresql")

# # Ensure the ENGINE is set correctly
# DATABASES["default"]["ENGINE"] = "django.db.backends.postgresql"

AUTH_PASSWORD_VALIDATORS = [
{
Expand Down
Loading