Update entrypoint.sh
Browse files- entrypoint.sh +6 -5
entrypoint.sh
CHANGED
|
@@ -1,19 +1,20 @@
|
|
| 1 |
#!/bin/bash
|
| 2 |
|
| 3 |
-
# Run migrations
|
| 4 |
python manage.py migrate
|
|
|
|
| 5 |
|
| 6 |
-
# Create
|
| 7 |
if ! python manage.py shell -c "from django.contrib.auth import get_user_model; print(get_user_model().objects.filter(username='admin').exists())"; then
|
| 8 |
echo "Creating superuser..."
|
| 9 |
echo "from django.contrib.auth import get_user_model; User = get_user_model(); User.objects.create_superuser('admin', 'admin@example.com', '${DJANGO_ADMIN_PASSWORD}')" | python manage.py shell
|
| 10 |
fi
|
| 11 |
|
| 12 |
-
#
|
| 13 |
{
|
| 14 |
-
sleep
|
|
|
|
| 15 |
curl -s "https://api.telegram.org/bot${TELEGRAM_TOKEN}/setWebhook?url=https://${HOST}/super_secter_webhook/"
|
| 16 |
} &
|
| 17 |
|
| 18 |
-
# Start server
|
| 19 |
exec gunicorn --bind 0.0.0.0:$PORT dtb.wsgi:application
|
|
|
|
| 1 |
#!/bin/bash
|
| 2 |
|
| 3 |
+
# Run migrations and static collection at runtime
|
| 4 |
python manage.py migrate
|
| 5 |
+
python manage.py collectstatic --noinput
|
| 6 |
|
| 7 |
+
# Create admin user if not exists
|
| 8 |
if ! python manage.py shell -c "from django.contrib.auth import get_user_model; print(get_user_model().objects.filter(username='admin').exists())"; then
|
| 9 |
echo "Creating superuser..."
|
| 10 |
echo "from django.contrib.auth import get_user_model; User = get_user_model(); User.objects.create_superuser('admin', 'admin@example.com', '${DJANGO_ADMIN_PASSWORD}')" | python manage.py shell
|
| 11 |
fi
|
| 12 |
|
| 13 |
+
# Start server and set webhook
|
| 14 |
{
|
| 15 |
+
sleep 3 # Wait for server to initialize
|
| 16 |
+
echo "Setting webhook..."
|
| 17 |
curl -s "https://api.telegram.org/bot${TELEGRAM_TOKEN}/setWebhook?url=https://${HOST}/super_secter_webhook/"
|
| 18 |
} &
|
| 19 |
|
|
|
|
| 20 |
exec gunicorn --bind 0.0.0.0:$PORT dtb.wsgi:application
|