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

feat: Workspace 145 #138

Merged
merged 14 commits into from
Sep 27, 2024
3 changes: 2 additions & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@ django-cors-headers = "==4.1.0"
django-csp = "==3.7"
django-import-export = "==4.0.3"
pyotp = "==2.9.0"
psycopg2-binary = "==2.9.9"
requests = "==2.32.2"
importlib-metadata = "==4.13.0" # TODO: remove. needed by old portal
django-formtools = "==2.2" # TODO: remove. needed by old portal
django-otp = "==1.0.2" # TODO: remove. needed by old portal
# https://pypi.org/user/codeforlife/
cfl-common = "==7.3.3" # TODO: remove
codeforlife-portal = "==7.3.3" # TODO: remove
rapid-router = "==6.5.2" # TODO: remove
rapid-router = "==6.5.3" # TODO: remove
phonenumbers = "==8.12.12" # TODO: remove

[dev-packages]
Expand Down
172 changes: 132 additions & 40 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 18 additions & 4 deletions codeforlife/settings/django.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,33 @@
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases


def get_databases(base_dir: Path): # pragma: no cover
def get_databases( # pragma: no cover
name: str = SERVICE_NAME,
host: str = "localhost",
port: int = 5432,
user: str = "root",
password: str = "password",
):
"""Get the databases for the Django project.

Args:
base_dir: The base directory of the Django project.
name: The name of the database.
host: The network the database is exposed on.
port: The port of the server the database is exposed on.
user: A registered user on the database server.
password: The password of the database server.

Returns:
The databases for the django project.
"""
return {
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": base_dir / "db.sqlite3",
"ENGINE": "django.db.backends.postgresql",
"NAME": os.getenv("DB_NAME", name),
"HOST": os.getenv("DB_HOST", host),
"PORT": int(os.getenv("DB_PORT", port)),
"USER": os.getenv("DB_USER", user),
"PASSWORD": os.getenv("DB_PASSWORD", password),
"ATOMIC_REQUESTS": True,
}
}
Expand Down
Loading