django-template/Makefile

40 lines
1.5 KiB
Makefile
Raw Permalink Normal View History

2021-04-01 09:58:13 +02:00
.DEFAULT_GOAL := help
help:
@perl -nle'print $& if m{^[a-zA-Z_-]+:.*?## .*$$}' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-25s\033[0m %s\n", $$1, $$2}'
2021-07-01 09:32:47 +02:00
format: ## Format style with black
2022-08-01 15:52:14 +02:00
black --exclude="/(postgres_data|venv|migrations|\.git)/" core/ apps/ scripts/ tests/
test: ## Tests
docker-compose -f docker-compose.dev.yaml exec -T django bash -c "pytest"
2021-07-01 09:32:47 +02:00
2021-07-01 09:30:41 +02:00
docker.recreate.django: ## Recreate Django image
2022-07-29 15:15:22 +02:00
docker-compose -f docker-compose.dev.yaml build --no-cache --force-rm django
docker-compose -f docker-compose.dev.yaml up --force-recreate --no-deps -d django
## make run.loaddata
2021-07-01 09:30:41 +02:00
2021-07-01 09:32:47 +02:00
run.makemigrations: ## Makemigrations
2022-06-27 14:28:40 +02:00
docker-compose -f docker-compose.yaml exec -T django bash -c "python3 manage.py makemigrations"
2021-07-01 09:30:41 +02:00
2021-07-01 09:32:47 +02:00
run.migrate: ## Migrate
2022-06-27 14:28:40 +02:00
docker-compose -f docker-compose.yaml exec -T django bash -c "python3 manage.py migrate"
2021-07-01 09:30:41 +02:00
2021-07-01 09:32:47 +02:00
run.loaddata: ## Load initial data
2021-07-01 09:30:41 +02:00
# Remove database
2022-07-29 15:15:22 +02:00
docker-compose exec -T django bash -c "python3 manage.py flush --noinput"
2021-07-01 09:30:41 +02:00
# Remove media
rm -rf media
2021-07-01 09:30:41 +02:00
# Migrate
2022-07-29 15:15:22 +02:00
docker-compose exec -T django bash -c "python3 manage.py migrate"
2021-07-01 09:30:41 +02:00
2022-08-09 11:33:45 +02:00
run.loaddata.fake: ## Load initial data test
2021-07-01 09:30:41 +02:00
make run.loaddata
# Add superuser: alias "admin" - password "admin"
2022-07-29 15:15:22 +02:00
docker-compose -f docker-compose.dev.yaml exec -T django bash -c "cat data/create_superuser.py | python3 manage.py shell"
run.server.dev: ## Run server
docker-compose -f docker-compose.dev.yaml up
2021-07-01 09:32:47 +02:00
2022-07-29 15:15:22 +02:00
run.server.pro: ## Run server
docker-compose -f docker-compose.pro.yaml up