#!/usr/bin/env bash
# start-server.sh
if [ -n "$DJANGO_SUPERUSER_USERNAME" ] && [ -n "$DJANGO_SUPERUSER_PASSWORD" ] ; then
    (cd e2eaf_django; python manage.py createsuperuser --no-input)
fi

# Move to main directory
cd e2eaf_django

# Collect static files
python manage.py collectstatic --no-input

# Start Guinicorn & NGinX
(gunicorn e2eaf_django.wsgi --user www-data --bind 0.0.0.0:8010 --workers 3) &
nginx -g "daemon off;"
