Merge pull request 'Setup Postgres for local development.' (#5) from feature/db_setup into main

Reviewed-on: #5
Reviewed-by: Maximilian Giller <max@giller.dev>
This commit is contained in:
jaku 2024-02-25 00:44:38 +01:00
commit d8cc7085ca
4 changed files with 30 additions and 3 deletions

8
db/README.md Normal file
View file

@ -0,0 +1,8 @@
## Postgres Setup with docker-compose
Start the postgres container with the following command:
```bash
docker-compose up -d
```
Alternatively, you can use a PyCharm configuration to start the container. (Docker > Docker Compose)

14
db/docker-compose.yml Normal file
View file

@ -0,0 +1,14 @@
version: '3.8'
services:
postgres:
image: postgres:latest
environment:
POSTGRES_DB: mixr-db
POSTGRES_USER: mixr-api
POSTGRES_PASSWORD: mypassword
ports:
- "5432:5432"
# Optional: Uncomment the following line to mount a volume for persistence
# volumes:
# - /path/on/host:/var/lib/postgresql/data

View file

@ -75,8 +75,12 @@ WSGI_APPLICATION = 'mixr_api.wsgi.application'
DATABASES = { DATABASES = {
'default': { 'default': {
'ENGINE': 'django.db.backends.sqlite3', 'ENGINE': 'django.db.backends.postgresql',
'NAME': BASE_DIR / 'db.sqlite3', 'NAME': 'mixr-db',
'USER': 'mixr-api',
'PASSWORD': 'mypassword',
'HOST': '127.0.0.1',
'PORT': '5432',
} }
} }

View file

@ -1 +1,2 @@
Django~=5.0.2 Django~=5.0.2
psycopg2-binary~=2.9.9