Skip to content

Commit

Permalink
add create django superuser if django superuser username is set
Browse files Browse the repository at this point in the history
  • Loading branch information
BesartSulejmani committed Jan 25, 2024
1 parent 8f4a69a commit b615a8b
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions bin/docker_start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,18 @@ if [ -d $fixtures_dir ]; then
done
fi

# Create superuser
# specify password by setting DJANGO_SUPERUSER_PASSWORD in the env
# specify username by setting DJANGO_SUPERUSER_USERNAME in the env
# specify email by setting DJANGO_SUPERUSER_EMAIL in the env
if [ -n "${DJANGO_SUPERUSER_USERNAME}" ]; then
python src/manage.py createsuperuser \
--no-input \
--username "${DJANGO_SUPERUSER_USERNAME}" \
--email "${DJANGO_SUPERUSER_EMAIL:-admin@admin.org}"
unset DJANGO_SUPERUSER_USERNAME DJANGO_SUPERUSER_EMAIL DJANGO_SUPERUSER_PASSWORD
fi

# Start server
>&2 echo "Starting server"
uwsgi \
Expand Down

0 comments on commit b615a8b

Please sign in to comment.