Skip to content

Commit 05abba8

Browse files
committed
Connect Django and Postgres
1 parent f9b909b commit 05abba8

File tree

4 files changed

+59
-3
lines changed

4 files changed

+59
-3
lines changed

backend/manager/manager/settings.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,12 @@
7878

7979
DATABASES = {
8080
'default': {
81-
'ENGINE': 'django.db.backends.sqlite3',
82-
'NAME': BASE_DIR / 'db.sqlite3',
81+
'ENGINE': 'django.db.backends.postgresql',
82+
'NAME': 'postgres',
83+
'USER': 'postgres',
84+
'PASSWORD': 'postgresSuperUserPsw',
85+
'HOST': 'manager-db',
86+
'PORT': '5432',
8387
}
8488
}
8589

backend/poetry.lock

Lines changed: 47 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backend/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ authors = ["Your Name <you@example.com>"]
88
python = "^3.8"
99
djangorestframework = "^3.12.4"
1010
whitenoise = "^5.3.0"
11+
psycopg2-binary = "^2.9.2"
1112

1213
[tool.poetry.dev-dependencies]
1314

deployment.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ spec:
1414
labels:
1515
app: manager
1616
spec:
17+
initContainers:
18+
- name: db-migrate
19+
image: backend
20+
command: ["python", "manage.py"]
21+
args: ["migrate"]
1722
containers:
1823
- name: backend
1924
image: backend

0 commit comments

Comments
 (0)