I've never use docker for development on local machine so I have few questions that I didn't find in documentation.
After setup I can't figure out how do I can install my packages via pip. I tried:
docker-compose -f local.yml run --rm django pip install some-package
. It installed package somewhere, but not in project. Do I need to build every time when I add new package?
How to run django managment commands in another thread
docker-compose -f local.yml run --rm django python manage.py mycommand
stop runserver
command that is not convenient
Where do I see celery tasks log ? How to run:
celery -A apps.taskapp worker -l info
celery -A apps.taskapp beat -l INFO
to see debug messages of my tasks
I am assuming you started your project using the cookiecutter-django
template.
First time setup you run docker-compose -f local.yml build
. This will install all the dependencies defined in local.txt
. If you add any customized pip package to either local.txt
or base.txt
, you will have to re-build the docker image `docker-compose -f local.yml build.
To run any commands in a docker container, you do:
docker-compose -f local.yml run django [commands you would like to run]
Note: in the above command django
is the name service defined in your local.yml
For example, to apply migrations in docker:
docker-compose -f local.yml run django python manage.py migrate
docker-compose -f local.yml up
You can inspect the logs of specific running docker container by:
docker logs -f [name or id of container]
which you can find out by:
docker ps
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With