Update entrypoint.sh
Browse files- entrypoint.sh +10 -4
entrypoint.sh
CHANGED
@@ -1,10 +1,16 @@
|
|
1 |
#!/bin/bash
|
2 |
|
3 |
-
#
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
python manage.py collectstatic --noinput
|
6 |
|
7 |
-
# Create admin user
|
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', '[email protected]', '${DJANGO_ADMIN_PASSWORD}')" | python manage.py shell
|
@@ -12,7 +18,7 @@ fi
|
|
12 |
|
13 |
# Start server and set webhook
|
14 |
{
|
15 |
-
sleep 3
|
16 |
echo "Setting webhook..."
|
17 |
curl -s "https://api.telegram.org/bot${TELEGRAM_TOKEN}/setWebhook?url=https://${HOST}/super_secter_webhook/"
|
18 |
} &
|
|
|
1 |
#!/bin/bash
|
2 |
|
3 |
+
# Create database directory if not exists
|
4 |
+
mkdir -p /data
|
5 |
+
|
6 |
+
# Set proper permissions
|
7 |
+
chmod 777 /data /static
|
8 |
+
|
9 |
+
# Run database operations
|
10 |
+
python manage.py migrate --noinput
|
11 |
python manage.py collectstatic --noinput
|
12 |
|
13 |
+
# Create admin user
|
14 |
if ! python manage.py shell -c "from django.contrib.auth import get_user_model; print(get_user_model().objects.filter(username='admin').exists())"; then
|
15 |
echo "Creating superuser..."
|
16 |
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
|
|
|
18 |
|
19 |
# Start server and set webhook
|
20 |
{
|
21 |
+
sleep 3
|
22 |
echo "Setting webhook..."
|
23 |
curl -s "https://api.telegram.org/bot${TELEGRAM_TOKEN}/setWebhook?url=https://${HOST}/super_secter_webhook/"
|
24 |
} &
|