sudo apt install docker.io docker-composeOptional requirements (for running application without dockerized environment)
pyenv (for installing different python versions)
pipenv (managing python virtual environments and packages)
Create .env.dev file with example development configuration:
POSTGRES_DB=movies_dev
POSTGRES_USER=movies
POSTGRES_PASSWORD=movies
SECRET_KEY=DEBUG_SECRET_KEY
DEBUG=1
DB_ENGINE=django.db.backends.postgresql
DB_NAME=movies_dev
DB_USER=movies
DB_PASSWORD=movies
DB_HOST=movies-db
DB_PORT=5432
DJANGO_ALLOWED_HOSTS=*Build and run docker-compose environment:
docker-compose up --build -dCheck docker containers up and running:
docker-compose psCheck containers logs:
docker-compose logs -fShut down development enironment:
docker-compose down -vAfter running docker-compose environment application will be available with links provided:
Smoke test endpoint: http://localhost:8000/ping/
API endpoints: http://localhost:8000/api/
OpenAPI v2 documentation (swagger): http://localhost:8000/swagger/
CoreAPI documentation: http://localhost:8000/docs/
Run tests in dockerized environment:
docker-compose up --build -d
docker-compose exec movies pytestRun tests with coverage report
docker-compose up --build -d
docker-compose exec movies pytest --covRun code quality checks:
docker-compose exec movies flake8 .
docker-compose exec movies black . --check
docker-compose exec movies isort . --check-onlyAutomatic formating and imports sorting:
docker-compose exec movies black .
docker-compose exec movies isort .Automatic CI/CD available with provided GitLab CI config (.gitlab-ci.yml).
Check Django settings.py file for other configurable environment variables.