Skip to content

Commit

Permalink
Install dj-database-url
Browse files Browse the repository at this point in the history
  • Loading branch information
tm-kn committed Nov 12, 2024
1 parent 81396f2 commit 456fb25
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 17 deletions.
6 changes: 6 additions & 0 deletions .isort.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[settings]
profile=black
sections=FUTURE,STDLIB,DJANGO,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
known_first_party=config
known_django=django
default_section=THIRDPARTY
1 change: 1 addition & 0 deletions config/jinja2.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from django.conf import settings
from django.templatetags.static import static
from django.urls import reverse

from jinja2 import Environment


Expand Down
14 changes: 4 additions & 10 deletions config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
from pathlib import Path
from sysconfig import get_path

import dj_database_url

from config.util import strtobool

PROJECT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
Expand Down Expand Up @@ -69,16 +71,8 @@
# Database
# https://docs.djangoproject.com/en/5.0/ref/settings/#databases

DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql",
"NAME": os.environ.get("DATABASE_NAME", ""),
"USER": os.environ.get("DATABASE_USER", ""),
"PASSWORD": os.environ.get("DATABASE_PASSWORD", ""),
"HOST": os.environ.get("DATABASE_HOST", ""),
"PORT": os.environ.get("DATABASE_PORT", "5432"),
}
}
DATABASES = {"default": dj_database_url.config(conn_max_age=600)}


# Password validation
# https://docs.djangoproject.com/en/5.0/ref/settings/#auth-password-validators
Expand Down
6 changes: 1 addition & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,7 @@ services:
- DJANGO_SETTINGS_MODULE=config.settings.develop
- SECRET_KEY=abc123
- NPM_DEVELOP_COMMAND=dev
- DATABASE_NAME=postgres
- DATABASE_USER=postgres
- DATABASE_PASSWORD=postgres
- DATABASE_HOST=db
- DATABASE_PORT=5432
- DATABASE_URL=postgres://postgres:postgres@db:5432/postgres
- DJANGO_SUPERUSER_PASSWORD=admin
- DJANGO_SUPERUSER_USERNAME=admin
- COOKIE_DOMAIN=localhost
Expand Down
30 changes: 28 additions & 2 deletions poetry.lock

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

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ django = "^5.0.7"
psycopg2-binary = "^2.9.9"
django-csp = "^3.8"
whitenoise = "^6.7.0"
dj-database-url = "^2.3.0"

[tool.poetry.group.dev]
optional = true
Expand Down

0 comments on commit 456fb25

Please sign in to comment.