Divio Shell Required

Divio Cloud projects are run in Docker containers. This means that interacting with the the project needs to be done a little differently from the standard way, when the project runs on the same system as your computer.

The commands you run (the typical python manage.py commands a Django developer uses daily) need to be run inside the container, not executed on your machine. 

To run python manage.py migrate in the Docker container you'd do:

docker-compose run --rm web python manage.py migrate

What this does is:

  • docker-compose : this command executes Docker operations based on the configuration in a docker-compose.yml  file in the same directory
  •   run : creates and runs a new container.   
  •  --rm: deletes the container after the command finishes (since this is a one-off command there is no sense in keeping it around)
  •   web : picks the web service out of docker-compose.yml
  •  python manage.py migrate : the command to run in the context of the container

In other words, the command needs to be prefixed with docker-compose run --rm web .

You can execute other commands too of course, such as bash to enable an interactive prompt within the container.

Within the container, all sourcecode is at /app . You'll find that all the needed requirements are installed and the Postgres database is linked and available.

Did this answer your question?