I have django-app which has docker-compose:
services:
web:
build: .
volumes:
- .:/code
ports:
- "80:80"
command: >
sh -c "python manage.py wait_for_db &&
python manage.py migrate &&
python manage.py runserver 0.0.0.0:80"
env_file:
- ./.env
depends_on:
- db
restart: always
(... here postgres, redis and celery)
and i have three questions about this:
- Doest it matter where we specify the ports? I think they should be after ports, but it works too.
- For example i want run my app on default 127.0.0.1:8000, but if i make:
ports:
"8000":"8000"
...
python manage.py runserver 127.0.0.1:8000
i cant get acess to my app. It works only on localhost when i runserver on 0.0.0.0:8000.
Can i run my app on default 127.0.0.1 or localhost only?
- Is there any "correct" order of components (build, volumes, ports, etc.) for django-app?