Get the dapp
submodule:
git submodule init
Uses the default Django development server.
-
Rename
.env.dev-sample
to.env
. -
Update the environment variables in the and .env.dev files.
-
Build the images and run the containers:
docker-compose up -d --build
Test it out at http://localhost:8000. The "app" folder is mounted into the container and your code changes apply automatically.
Note: You need up and running containers to run next commands otherwise you will get ERROR: No container found for web_1
!
-
You need to make migrations?
./scripts/makemigrations.sh
-
You need to apply migrations?
./scripts/migrate.sh
-
You need a shell inside container?
./scripts/shell.sh
-
You wand direct db shell?
./scripts/psql.sh
-
Anything else?
docker-compose exec <SERVICE> <COMMAND>
Uses gunicorn + nginx.
Follow https://dockerswarm.rocks/ till the end of Portainer section.
-
Rename .env.prod-sample to .env. Update the environment variables.
-
Build the images and run the containers:
docker-compose -f docker-compose.prod.yml up -d --build
Test it out at http://localhost:1818. No mounted folders. To apply changes, the image must be re-built.
Docker files inspired from https://github.com/testdrivenio/django-on-docker/