5

I am a noob and I am trying to create a website following the tutorial from this guy: http://support.divio.com/academy/basic-how-to-build-a-website-and-blog-with-django-cms-60-minutes/introduction. It looks like I am stack at the part which I setup the local server of my project. When I do this a message appears on the power shell which says:

Waiting for local database server Couldn't connect to database container. 
Database server may not have started. 

I tried to find where the database is located but I couldn't do it. Does it have to do that I am using a windows OS and Linux containers?

Daniele Procida
  • 1,477
  • 10
  • 27

2 Answers2

1

You can check if the database container is running locally by running:

docker ps

You should see a database container listed in the output:

... example_db_1

You can check if the correct database is available and contactable from the web container with:

docker-compose run --rm web psql -h postgres -U postgres db
Daniele Procida
  • 1,477
  • 10
  • 27
0

I had this same error and Divio support got back to me within just a few minutes to fix it.

Their fix was to basically to delete two lines from docker-compose.yml in your project directory so it reads:

version: "2"

services:
  web:
    build: "."
    links:
      - "db:postgres"
    ports:
      - "8000:80"
    volumes:
      - ".:/app:rw"
      - "./data:/data:rw"
    command: python manage.py runserver 0.0.0.0:80
    env_file: .env-local

  db:
    image: postgres:9.6-alpine
    environment:
      POSTGRES_DB: "db"
    volumes:
      - ".:/app:rw"

Then download the database again and restart the project. Hope that helps, and if not I can highly recommend contacting Divio support through their chat (bottom right of this page).

Peter F
  • 793
  • 8
  • 10
  • 1
    This will solve a problem for Windows/Linux users, when you have an error `FATAL: data directory "/var/lib/postgresql/data/pgdata" has wrong ownership `; however I am not certain it will help in the case of `Waiting for local database server`. – Daniele Procida Dec 13 '18 at 17:21