From e9d0a55d28721bda09ecfc43e5efbb829f214045 Mon Sep 17 00:00:00 2001 From: Roldel <38661724+roldel@users.noreply.github.com> Date: Mon, 3 Jan 2022 06:06:02 +0000 Subject: [PATCH] ADD env variables to db container FIX Error: Database is uninitialized and superuser password is not specified. Env vars needs to be defined in both the "db" and "web" containers In "db", so it can create the default user from it In "web", so it can be used in settings.py to connect django to the postgres container --- samples/django.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/samples/django.md b/samples/django.md index affb33805c..811e907a57 100644 --- a/samples/django.md +++ b/samples/django.md @@ -75,6 +75,10 @@ and a `docker-compose.yml` file. (You can use either a `.yml` or `.yaml` extensi image: postgres volumes: - ./data/db:/var/lib/postgresql/data + environment: + - POSTGRES_NAME=postgres + - POSTGRES_USER=postgres + - POSTGRES_PASSWORD=postgres web: build: . command: python manage.py runserver 0.0.0.0:8000