painless-continuous-delivery icon indicating copy to clipboard operation
painless-continuous-delivery copied to clipboard

`manage.py dbshell` not working with Docker setup

Open bittner opened this issue 8 years ago • 5 comments

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 dbshell should 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).

bittner avatar Feb 15 '17 23:02 bittner

Thank you

akikochuchu avatar Mar 18 '17 03:03 akikochuchu

@bittner any update/fix for this?

vkgyl2432 avatar Jun 03 '18 07:06 vkgyl2432

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 avatar Jun 03 '18 13:06 bittner

@bittner any update?

ashrafkvt avatar Mar 26 '23 20:03 ashrafkvt

This is easier to do than ever now.

  1. The Dockerfile is flexible enough to pick any requirements.txt file you need.
  2. You can simply add the needed development dependencies to requirements-dev.txt in your Django or Flask project.
  3. The docker-compose.yml file 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:

bittner avatar Mar 27 '23 06:03 bittner