File size: 879 Bytes
b20b7fe 3cca2d6 4caa71b 96d209a 3cca2d6 b20b7fe 96d209a b20b7fe 4caa71b 96d209a 3cca2d6 4caa71b 96d209a b20b7fe |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
#!/bin/bash
# Create database directory if not exists
mkdir -p /data
# Set proper permissions
chmod 777 /data /static
# Run database operations
python manage.py migrate --noinput
python manage.py collectstatic --noinput
# Create admin user
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
# Start server and set webhook
{
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 |