Update Makefile

This commit is contained in:
Andros Fenollosa 2021-07-01 09:32:47 +02:00 committed by GitHub
parent 831a9e0be6
commit 7707916b62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,18 +2,24 @@
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}' @perl -nle'print $& if m{^[a-zA-Z_-]+:.*?## .*$$}' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-25s\033[0m %s\n", $$1, $$2}'
lint: ## Check style with black
black --check --exclude="/(postgres|venv|migrations|\.git)/" .
format: ## Format style with black
black --exclude="/(postgres|venv|migrations|\.git)/" .
docker.recreate.django: ## Recreate Django image docker.recreate.django: ## Recreate Django image
docker-compose -f docker-compose.dev.yaml build --no-cache --force-rm django 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 docker-compose -f docker-compose.dev.yaml up --force-recreate --no-deps -d django
make run.loaddata make run.loaddata
run.makemigrations: run.makemigrations: ## Makemigrations
docker-compose -f docker-compose.dev.yaml exec -T django bash -c "python3 manage.py makemigrations" docker-compose -f docker-compose.dev.yaml exec -T django bash -c "python3 manage.py makemigrations"
run.migrate: run.migrate: ## Migrate
docker-compose -f docker-compose.dev.yaml exec -T django bash -c "python3 manage.py migrate" docker-compose -f docker-compose.dev.yaml exec -T django bash -c "python3 manage.py migrate"
run.loaddata: run.loaddata: ## Load initial data
# Remove database # Remove database
rm -rf database.sqlite rm -rf database.sqlite
# Remove media # Remove media
@ -21,12 +27,12 @@ run.loaddata:
# Migrate # Migrate
docker-compose -f docker-compose.dev.yaml exec -T django bash -c "python3 manage.py migrate" docker-compose -f docker-compose.dev.yaml exec -T django bash -c "python3 manage.py migrate"
run.loaddata.test: run.loaddata.test: ## Load initial data test
make run.loaddata make run.loaddata
# Add superuser: alias "admin" - password "admin" # Add superuser: alias "admin" - password "admin"
docker-compose -f docker-compose.dev.yaml exec -T django bash -c "cat data/create_superuser.py | python3 manage.py shell" docker-compose -f docker-compose.dev.yaml exec -T django bash -c "cat data/create_superuser.py | python3 manage.py shell"
# Add more users: alias random - password "password" # Add more users: alias random - password "password"
docker-compose -f docker-compose.dev.yaml exec -T django bash -c "cat data/create_users.py | python3 manage.py shell" docker-compose -f docker-compose.dev.yaml exec -T django bash -c "cat data/create_users.py | python3 manage.py shell"
run.server: run.server: ## Run server
docker-compose -f docker-compose.dev.yaml up docker-compose -f docker-compose.dev.yaml up