#!/usr/bin/env bash set -euo pipefail # scripts/create_superuser.sh # Usage: ./scripts/create_superuser.sh # This script reads ADMIN_USERNAME, ADMIN_EMAIL, ADMIN_PASSWORD from .env (or environment) # and creates the superuser inside the Django web container. BASE_DIR="$(cd "$(dirname "$0")/.." && pwd)" if [[ -f "$BASE_DIR/.env" ]]; then export $(grep -v '^#' $BASE_DIR/.env | xargs) fi : ${ADMIN_USERNAME:="admin"} : ${ADMIN_EMAIL:="admin@example.com"} : ${ADMIN_PASSWORD:="changeme"} echo "Creating superuser: $ADMIN_USERNAME" docker-compose exec -T web python manage.py shell <