|
|
@ -3,16 +3,21 @@ |
|
|
|
set -o errexit |
|
|
|
|
|
|
|
echo "Making staticfiles" |
|
|
|
if [[ ! -d "app/staticfiles" ]]; then python app/manage.py collectstatic --noinput; fi |
|
|
|
static_dir=staticfiles |
|
|
|
mkdir -p client/dist/static |
|
|
|
if [[ ! -d $static_dir ]] || [[ -z $(ls -A $static_dir) ]]; then |
|
|
|
echo "Executing collectstatic" |
|
|
|
python manage.py collectstatic --noinput; |
|
|
|
fi |
|
|
|
|
|
|
|
echo "Initializing database" |
|
|
|
python app/manage.py wait_for_db |
|
|
|
python app/manage.py migrate |
|
|
|
python app/manage.py create_roles |
|
|
|
python manage.py wait_for_db |
|
|
|
python manage.py migrate |
|
|
|
python manage.py create_roles |
|
|
|
|
|
|
|
echo "Creating admin" |
|
|
|
if [[ -n "${ADMIN_USERNAME}" ]] && [[ -n "${ADMIN_PASSWORD}" ]] && [[ -n "${ADMIN_EMAIL}" ]]; then |
|
|
|
python app/manage.py create_admin \ |
|
|
|
python manage.py create_admin \ |
|
|
|
--username "${ADMIN_USERNAME}" \ |
|
|
|
--password "${ADMIN_PASSWORD}" \ |
|
|
|
--email "${ADMIN_EMAIL}" \ |
|
|
@ -21,4 +26,4 @@ if [[ -n "${ADMIN_USERNAME}" ]] && [[ -n "${ADMIN_PASSWORD}" ]] && [[ -n "${ADMI |
|
|
|
fi |
|
|
|
|
|
|
|
echo "Starting django" |
|
|
|
gunicorn --bind="0.0.0.0:${PORT:-8000}" --workers="${WORKERS:-1}" --pythonpath=app app.wsgi --timeout 300 |
|
|
|
gunicorn --bind="0.0.0.0:${PORT:-8000}" --workers="${WORKERS:-1}" app.wsgi --timeout 300 |