painless-continuous-delivery
painless-continuous-delivery copied to clipboard
`manage.py dbshell` not working with Docker setup
Current Behavior
As a developer
when I use Docker Compose for development
and I try to run python manage.py dbshell
then execution is aborted,
because the database client is missing on the application image.
$ docker-compose run application python manage.py dbshell
CommandError: You appear not to have the 'psql' program installed or on your path.
Expected Behavior
- Whether we use a Postgres database or Mariadb/MySQL with Django in our Docker setup,
python manage.py dbshellshould always work in development (as without Docker). - For production, the database client is not needed, and should ideally not be integrated (to reduce image size, operational and security risks).
Thank you
@bittner any update/fix for this?
Not yet, but this should be much cleaner to fix today. With pipenv we can now cleanly put development dependencies into a project.
We'd have to replace the requirements.txt file by a Pipfile. Would you want to take a look at the Pipfile format and try to place a pull request?
@bittner any update?
This is easier to do than ever now.
- The
Dockerfileis flexible enough to pick anyrequirements.txtfile you need. - You can simply add the needed development dependencies to
requirements-dev.txtin your Django or Flask project. - The
docker-compose.ymlfile will pick up those new requirements when you develop locally.
Hence, if you want to contribute and open a PR to add the required dependency to requirements-dev.txt please go ahead! (Note that we need to make it conditional based on the chosen database.)
Thanks for pinging! :+1: :100: