Superuser is created in the seed migration

users/migrations/0002
This commit is contained in:
Midgard 2020-07-25 12:32:04 +02:00
parent 4573d0ae94
commit 8d17100677
Signed by: midgard
GPG key ID: 511C112F1331BBB4

View file

@ -1,8 +1,5 @@
KERS_DB_BACKEND ?= mysql KERS_DB_BACKEND ?= mysql
KERS_SQLITE_FILE ?= kers.sqlite3 KERS_SQLITE_FILE ?= kers.sqlite3
KERS_SUPERUSER_ZEUSID ?= 1
KERS_SUPERUSER_NAME ?= admin
KERS_SUPERUSER_PASSWORD ?= admin
# Discover virtualenv location # Discover virtualenv location
PYTHON ?= $(shell find -mindepth 3 -maxdepth 3 -path "*/bin/python") PYTHON ?= $(shell find -mindepth 3 -maxdepth 3 -path "*/bin/python")
@ -20,14 +17,11 @@ celery:
beat: beat:
$(VENVBIN)/celery -A KeRS beat -l info --scheduler django_celery_beat.schedulers:DatabaseScheduler $(VENVBIN)/celery -A KeRS beat -l info --scheduler django_celery_beat.schedulers:DatabaseScheduler
.PHONY: migrations migrate superuser .PHONY: migrations migrate
migrations: migrations:
$(PYTHON) manage.py makemigrations $(PYTHON) manage.py makemigrations
migrate: migrate:
$(PYTHON) manage.py 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: reset_db rewrite_migrations .PHONY: reset_db rewrite_migrations
reset_db: reset_db: