SQLITE_FILE ?= kers.sqlite3 PYTHON := $(shell find -mindepth 3 -maxdepth 3 -path "*/bin/python") ifeq ($(PYTHON),) $(error No virtualenv found) endif VENVBIN := $(dir $(PYTHON)) .PHONY: server celery beat rewrite_migrations server: $(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