|
#!/bin/bash |
|
|
|
|
|
mkdir -p /data |
|
|
|
|
|
chmod 777 /data /static |
|
|
|
|
|
python manage.py migrate --noinput |
|
python manage.py collectstatic --noinput |
|
|
|
|
|
if ! python manage.py shell -c "from django.contrib.auth import get_user_model; print(get_user_model().objects.filter(username='admin').exists())"; then |
|
echo "Creating superuser..." |
|
echo "from django.contrib.auth import get_user_model; User = get_user_model(); User.objects.create_superuser('admin', '[email protected]', '${DJANGO_ADMIN_PASSWORD}')" | python manage.py shell |
|
fi |
|
|
|
|
|
{ |
|
sleep 3 |
|
echo "Setting webhook..." |
|
curl -s "https://api.telegram.org/bot${TELEGRAM_TOKEN}/setWebhook?url=https://${HOST}/super_secter_webhook/" |
|
} & |
|
|
|
exec gunicorn --bind 0.0.0.0:$PORT dtb.wsgi:application |