SHELL := bash

project_paths = photoalbum config
run_django = docker-compose run --rm django
manage_py = ${run_django} ./manage.py

check-imports:
	isort --check-only --diff ${project_paths}

sort-imports:
	isort ${project_paths}

flake:
	flake8 ${project_paths}

black:
	black ${project_paths}

bandit:
	bandit -c bandit.yml -r ${project_paths}

check:
	${manage_py} check

check-migrations:
	${manage_py} makemigrations --dry-run --check

manage:
	${manage_py} ${args}

bash:
	${run_django} bash

shell:
	${manage_py} shell

shell_plus:
	${manage_py} shell_plus

migrate:
	${manage_py} migrate ${args}

makemigrations:
	${manage_py} makemigrations ${args}

createsuperuser:
	${manage_py} createsuperuser

test:
	${run_django} pytest ${args}

run:
	docker-compose up django

runcelery:
	docker-compose up celeryworker celerybeat

lint: sort-imports black flake check check-migrations
