2020-07-25 10:44:18 +02:00
|
|
|
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
|
2020-07-22 04:02:13 +02:00
|
|
|
celery:
|
2020-07-25 10:44:18 +02:00
|
|
|
$(VENVBIN)/celery -A KeRS worker -l info
|
2020-07-22 04:02:13 +02:00
|
|
|
beat:
|
2020-07-25 10:44:18 +02:00
|
|
|
$(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
|