Jose gabriel guzman
License : MIT
- Docker 17.05+.
- Docker Compose 1.17+
Before you begin, check out the local.yml file in the root of this project. Keep note of how it provides configuration for the following services:
- django: your application running behind Gunicorn;
- postgres: PostgreSQL database with the application’s relational data;
- redis: Redis instance for caching;
- traefik: Traefik reverse proxy with HTTPS on by default. Provided you have opted for
Celery (via setting use_celery to y) there are three more services:
- celeryworker running a Celery worker process;
- celerybeat running a Celery beat process;
- flower running Flower.
The flower service is served by Traefik over HTTPS, through the port 5555. For more information about Flower and its login credentials, check out Celery Flower instructions for local environment.
This can take a while, especially the first time you run this particular command on your development system:
$ docker-compose -f local.yml build
Generally, if you want to emulate production environment use production.yml instead. And this is true for any other actions you might need to perform: whenever a switch is required, just do it!
This brings up both Django and PostgreSQL. The first time it is run it might take a while to get started, but subsequent runs will occur quickly.
Open a terminal at the project root and run the following for local development:
$ docker-compose -f local.yml up
You can also set the environment variable COMPOSE_FILE pointing to local.yml like this:
$ export COMPOSE_FILE=local.yml
And then run:
$ docker-compose up
To run in a detached (background) mode, just:
$ docker-compose up -d
As with any shell command that we wish to run in our container, this is done using the docker-compose -f local.yml run --rm command:
$ docker-compose -f local.yml run --rm django python manage.py migrate
$ docker-compose -f local.yml run --rm django python manage.py createsuperuser
extended documentation
https://cookiecutter-django.readthedocs.io/en/latest/deployment-with-docker.html#prerequisites
First of all remember to download and import the postman environment to access the api documentation.