Update Makefile

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

View File

@ -2,32 +2,31 @@
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}'
clean: clean-build clean-pyc 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 up --force-recreate --no-deps -d django
make run.loaddata
clean-build: ## remove build artifacts run.makemigrations:
rm -fr build/ docker-compose -f docker-compose.dev.yaml exec -T django bash -c "python3 manage.py makemigrations"
rm -fr dist/
rm -fr *.egg-info
clean-pyc: ## remove Python file artifacts run.migrate:
find . -name '*.pyc' -exec rm -f {} + docker-compose -f docker-compose.dev.yaml exec -T django bash -c "python3 manage.py migrate"
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
lint: ## check style with flake8 run.loaddata:
flake8 . # Remove database
black --check . rm -rf database.sqlite
node_modules/.bin/prettier --check . # Remove media
rm -rf media
test: ## run tests quickly with the default Python # Migrate
pytest docker-compose -f docker-compose.dev.yaml exec -T django bash -c "python3 manage.py migrate"
sdist: clean ## package
python setup.py sdist
ls -l dist
run.migrations:
docker-compose -f docker-compose.dev.yaml run --rm -T --no-deps web sh -c "python manage.py migrate"
run.loaddata.test:
make run.loaddata
# 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"
# 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"
run.server: run.server:
docker-compose -f docker-compose.dev.yaml up docker-compose -f docker-compose.dev.yaml up