Skip to content

Commit

Permalink
feat(docker): Migrate before creating superuser
Browse files Browse the repository at this point in the history
  • Loading branch information
ravi0lii committed Jun 5, 2020
1 parent b52fcfb commit 939612a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#!/usr/bin/env bash

# Automatic migrate
if [ -n "$DJANGO_AUTOMATIC_MIGRATE" ] ; then
python manage.py migrate --settings carddeckserver.settings.prod
fi

# Create superuser if parameters were supplied
if [ -n "$DJANGO_SUPERUSER_USERNAME" ] && [ -n "$DJANGO_SUPERUSER_PASSWORD" ] ; then
python manage.py createsuperuser --settings carddeckserver.settings.prod --no-input
Expand All @@ -11,11 +16,6 @@ if [ -n "$DJANGO_COLLECTSTATIC" ] ; then
chown -R www-data:www-data /app/static/
fi

# Automatic migrate
if [ -n "$DJANGO_AUTOMATIC_MIGRATE" ] ; then
python manage.py migrate --settings carddeckserver.settings.prod
fi

# Run the server
gunicorn carddeckserver.wsgi --user www-data --bind 0.0.0.0:8010 --workers 3 &
nginx -g "daemon off;"

0 comments on commit 939612a

Please sign in to comment.