Create entrypoint.sh
Browse files- entrypoint.sh +14 -0
entrypoint.sh
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
|
3 |
+
# Create superuser if it doesn't exist
|
4 |
+
if ! python manage.py shell -c "from django.contrib.auth import get_user_model; print(get_user_model().objects.filter(username='admin').exists())"; then
|
5 |
+
echo "Creating superuser..."
|
6 |
+
echo "from django.contrib.auth import get_user_model; User = get_user_model(); User.objects.create_superuser('admin', '[email protected]', 'your_password_here')" | python manage.py shell
|
7 |
+
fi
|
8 |
+
|
9 |
+
# Set the webhook for the Telegram bot
|
10 |
+
echo "Setting webhook..."
|
11 |
+
curl -s "https://api.telegram.org/bot$TELEGRAM_TOKEN/setWebhook?url=https://$HOST/super_secter_webhook/"
|
12 |
+
|
13 |
+
# Start the Gunicorn server
|
14 |
+
exec gunicorn --bind 0.0.0.0:$PORT dtb.wsgi:application
|