Answer the question
In order to leave comments, you need to log in
Django server not running from docker-compose?
I'm trying to run a django application through docker with a base on postgres
docker-compose.yml:
version: '3.7'
services:
db:
image: postgres:latest
environment:
POSTGRES_PASSWORD: 'password'
volumes:
- postgres_data:/var/lib/postgresql/data/
web:
build: .
command: python /usr/src/dm_rest/manage.py runserver 0.0.0.0:8000
volumes:
- .:/usr/src/dm_rest
ports:
- 8000:8000
depends_on:
- db
volumes:
postgres_data:
FROM python:3.8
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
WORKDIR /usr/src/dm_rest
COPY ./req.txt /usr/src/dm_rest
RUN pip install -r /usr/src/dm_rest/req.txt
COPY . /usr/src/dm_rest/
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'postgres',
'USER': 'postgres',
'PASSWORD': 'password',
'HOST': 'db',
'PORT': '5432',
}
}
Answer the question
In order to leave comments, you need to log in
In general, for some reason, the server was not at 127.0.0.1:8000, but at the ip of the virtual machine
I would start by checking that Popstgres is running and that the database is correct.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question