Skip to content

Commit

Permalink
Making use of the custom Django command
Browse files Browse the repository at this point in the history
  • Loading branch information
willianantunes committed May 1, 2019
1 parent 90cee8b commit f72eb06
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions scripts/start.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,7 @@
#!/usr/bin/env bash
python manage.py makemigrations
python manage.py migrate

echo "Querying ADMIN table..."
count=$(echo "from django.contrib.auth import get_user_model;\
User = get_user_model();\
print(len(User.objects.all()))" | python manage.py shell)

echo "Admins configured: ${count}"

if [ ${count} -eq 0 ] ; then
echo "Creating temporary ADMIN user..."
echo "from django.contrib.auth import get_user_model;\
User = get_user_model();\
User.objects.create_superuser('admin', None, 'admin')" | python manage.py shell
fi

python manage.py seed_db --create-super-user

if [[ ${DJANGO_BIND_ADDRESS+x} ]] && [[ ${DJANGO_BIND_PORT+x} ]];
then
Expand Down

0 comments on commit f72eb06

Please sign in to comment.