M-makefile?
This commit is contained in:
parent
4f4d2da551
commit
2f76476057
1 changed files with 19 additions and 6 deletions
25
Makefile
25
Makefile
|
@ -1,13 +1,17 @@
|
|||
SQLITE_FILE ?= kers.sqlite3
|
||||
KERS_SUPERUSER_ZEUSID ?= 1
|
||||
KERS_SUPERUSER_NAME ?= admin
|
||||
KERS_SUPERUSER_PASSWORD ?= admin
|
||||
|
||||
PYTHON := $(shell find -mindepth 3 -maxdepth 3 -path "*/bin/python")
|
||||
# Discover virtualenv location
|
||||
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
|
||||
|
||||
.PHONY: server celery beat
|
||||
server:
|
||||
$(PYTHON) manage.py runserver
|
||||
celery:
|
||||
|
@ -15,11 +19,20 @@ celery:
|
|||
beat:
|
||||
$(VENVBIN)/celery -A KeRS beat -l info --scheduler django_celery_beat.schedulers:DatabaseScheduler
|
||||
|
||||
.PHONY: migrations migrate superuser
|
||||
migrations:
|
||||
$(PYTHON) manage.py makemigrations
|
||||
migrate:
|
||||
$(PYTHON) manage.py migrate
|
||||
superuser:
|
||||
(sleep 1; echo "$(KERS_SUPERUSER_PASSWORD)"; sleep 0.5; echo "$(KERS_SUPERUSER_PASSWORD)"; sleep 1; echo "y") | \
|
||||
socat - EXEC:'$(PYTHON) manage.py createsuperuser --username $(KERS_SUPERUSER_NAME) --zeus_id $(KERS_SUPERUSER_ZEUSID)',pty,setsid,ctty
|
||||
|
||||
.PHONY: rewrite_migrations
|
||||
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
|
||||
make migrations
|
||||
make migrate
|
||||
make superuser
|
||||
|
|
Loading…
Reference in a new issue