#!/bin/sh
set -e

echo "=== Tikta Django ==="
echo "  DB host: ${DB_HOST}:${DB_PORT}"

echo "Running database migrations..."
python manage.py migrate --noinput --fake-initial

echo "Collecting static files..."
python manage.py collectstatic --noinput --clear

echo "Starting Gunicorn..."
exec gunicorn config.wsgi:application \
    --bind 0.0.0.0:8000 \
    --workers 4 \
    --timeout 120 \
    --access-logfile - \
    --error-logfile -
