Setup Postgres for local development.

This commit is contained in:
Jannes Kurth 2024-02-25 00:20:51 +01:00
parent 4c1a8be6af
commit 25c0482d7b
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 = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
'ENGINE': 'django.db.backends.postgresql',
'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