2020-07-25 11:53:37 +02:00
|
|
|
KERS_DB_BACKEND ?= mysql
|
|
|
|
KERS_SQLITE_FILE ?= kers.sqlite3
|
2020-07-25 10:44:18 +02:00
|
|
|
|
2020-07-25 10:59:30 +02:00
|
|
|
# Discover virtualenv location
|
|
|
|
PYTHON ?= $(shell find -mindepth 3 -maxdepth 3 -path "*/bin/python")
|
2020-07-25 10:44:18 +02:00
|
|
|
ifeq ($(PYTHON),)
|
2020-07-25 11:04:56 +02:00
|
|
|
$(error No virtualenv found)
|
2020-07-25 10:44:18 +02:00
|
|
|
endif
|
|
|
|
VENVBIN := $(dir $(PYTHON))
|
|
|
|
|
|
|
|
|
2020-07-25 10:59:30 +02:00
|
|
|
.PHONY: server celery beat
|
2020-07-25 10:44:18 +02:00
|
|
|
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
|
|
|
|
|
2020-07-25 12:32:04 +02:00
|
|
|
.PHONY: migrations migrate
|
2020-07-25 10:59:30 +02:00
|
|
|
migrations:
|
|
|
|
$(PYTHON) manage.py makemigrations
|
|
|
|
migrate:
|
|
|
|
$(PYTHON) manage.py migrate
|
|
|
|
|
2020-07-25 11:53:37 +02:00
|
|
|
.PHONY: reset_db rewrite_migrations
|
|
|
|
reset_db:
|
2020-07-25 12:12:11 +02:00
|
|
|
@case "$(KERS_DB_BACKEND)" in \
|
2020-07-25 11:53:37 +02:00
|
|
|
mysql) printf "Please drop your MySQL/MariaDB tables and press enter"; read; ;; \
|
2020-07-25 12:12:11 +02:00
|
|
|
sqlite3) echo 'rm -f "$(KERS_SQLITE_FILE)"'; rm -f "$(KERS_SQLITE_FILE)"; ;; \
|
2020-07-25 11:53:37 +02:00
|
|
|
esac
|
|
|
|
make migrate
|
2020-07-25 10:44:18 +02:00
|
|
|
rewrite_migrations:
|
2020-07-26 00:56:43 +02:00
|
|
|
@echo "We have data in production. This is not allowed any more."; exit 1
|