Did somebody say "Makefile"?

This commit is contained in:
Midgard 2020-07-25 10:44:18 +02:00
parent ab8b7258a7
commit 4f4d2da551
Signed by: midgard
GPG key ID: 511C112F1331BBB4

View file

@ -1,6 +1,25 @@
celery: SQLITE_FILE ?= kers.sqlite3
celery -A KeRS worker -l info
beat: PYTHON := $(shell find -mindepth 3 -maxdepth 3 -path "*/bin/python")
celery -A KeRS beat -l info --scheduler django_celery_beat.schedulers:DatabaseScheduler ifeq ($(PYTHON),)
$(error No virtualenv found)
endif
VENVBIN := $(dir $(PYTHON))
.PHONY: server celery beat rewrite_migrations
server: server:
python manage.py runserver $(PYTHON) manage.py runserver
celery:
$(VENVBIN)/celery -A KeRS worker -l info
beat:
$(VENVBIN)/celery -A KeRS beat -l info --scheduler django_celery_beat.schedulers:DatabaseScheduler
rewrite_migrations:
@printf "Only for when there is no data in production yet. Continue? (y/N) "; read continue; [ "$$continue" = y ]
rm -f events/migrations/0*_*.py users/migrations/0*_*.py
rm -f "$(SQLITE_FILE)"
$(PYTHON) manage.py makemigrations
$(PYTHON) manage.py migrate
(sleep 1; echo "admin"; sleep 0.5; echo "admin"; sleep 1; echo "y") | \
socat - EXEC:'$(PYTHON) manage.py createsuperuser --username admin --zeus_id 1',pty,setsid,ctty