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:
commit
d8cc7085ca
4 changed files with 30 additions and 3 deletions
8
db/README.md
Normal file
8
db/README.md
Normal 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
14
db/docker-compose.yml
Normal 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
|
|
@ -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',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
Django~=5.0.2
|
Django~=5.0.2
|
||||||
|
psycopg2-binary~=2.9.9
|
Loading…
Reference in a new issue