Update healthchecks-install.sh
This commit is contained in:
parent
b641424796
commit
c04fcfea68
@ -89,17 +89,26 @@ SITE_NAME=Mychecks
|
|||||||
SITE_ROOT=http://0.0.0.0:8000
|
SITE_ROOT=http://0.0.0.0:8000
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# python3 manage.py migrate
|
ADMIN_EMAIL="admin@helper-scripts.local"
|
||||||
# cat <<EOF | python3 /opt/healthchecks/manage.py shell
|
ADMIN_PASSWORD="$DB_PASS"
|
||||||
# from django.contrib.auth import get_user_model
|
|
||||||
# UserModel = get_user_model()
|
|
||||||
# user = UserModel.objects.create_user('admin', password='$DB_PASS')
|
|
||||||
# user.is_superuser = True
|
|
||||||
# user.is_staff = True
|
|
||||||
# user.save()
|
|
||||||
# EOF
|
|
||||||
# ./manage.py createsuperuser
|
|
||||||
|
|
||||||
|
cat <<EOF | $STD .venv/bin/python3 manage.py shell
|
||||||
|
from django.contrib.auth import get_user_model
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
|
if not User.objects.filter(email="${ADMIN_EMAIL}").exists():
|
||||||
|
u = User.objects.create_superuser(
|
||||||
|
username="${ADMIN_EMAIL}",
|
||||||
|
email="${ADMIN_EMAIL}",
|
||||||
|
password="${ADMIN_PASSWORD}"
|
||||||
|
)
|
||||||
|
u.is_active = True
|
||||||
|
u.is_staff = True
|
||||||
|
u.is_superuser = True
|
||||||
|
u.save()
|
||||||
|
EOF
|
||||||
|
|
||||||
|
$STD python3 manage.py migrate
|
||||||
msg_ok "Installed healthchecks"
|
msg_ok "Installed healthchecks"
|
||||||
|
|
||||||
msg_info "Creating Service"
|
msg_info "Creating Service"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user