Django create superuser from batch file

As it seems you can't provide a password with the echo ''stuff | cmd, the only way I see to do it is to create it in Python:

python manage.py syncdb --noinput
echo "from django.contrib.auth.models import User; User.objects.create_superuser('admin', '[email protected]', 'pass')" | python manage.py shell
python manage.py runserver

As of Django 3.0 (per the docs) you can use the createsuperuser --no-input option and set the password with the DJANGO_SUPERUSER_PASSWORD environment variable, e.g.,

DJANGO_SUPERUSER_PASSWORD=my_password ./manage.py createsuperuser \
    --no-input \
    --username=my_user \
    [email protected]

or, using all environment variables:

DJANGO_SUPERUSER_PASSWORD=my_password \
DJANGO_SUPERUSER_USERNAME=my_user \
[email protected] \
./manage.py createsuperuser \
--no-input