-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconapp.sh
More file actions
39 lines (29 loc) · 1003 Bytes
/
Copy pathconapp.sh
File metadata and controls
39 lines (29 loc) · 1003 Bytes
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
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env bash
set -o errexit
echo "🔄 Actualizando pip, setuptools y wheel..."
python -m pip install --upgrade pip setuptools wheel
echo "📦 Instalando dependencias del proyecto..."
python -m pip install -r requirements.txt
echo "📁 Recolectando archivos estáticos..."
python manage.py collectstatic --no-input
echo "🧩 Creando migraciones..."
python manage.py makemigrations
echo "🗄️ Aplicando migraciones..."
python manage.py migrate
echo "👤 Creando superusuario si no existe..."
python manage.py shell << EOF
from django.contrib.auth import get_user_model
User = get_user_model()
username = "anyoli"
email = ""
password = "3788"
user = User.objects.filter(username=username).first()
if not user:
user = User(username=username, email=email, is_staff=True, is_superuser=True)
user.set_password(password)
user.save()
print("Superusuario creado correctamente.")
else:
print("El superusuario ya existe.")
EOF
echo "✅ Deploy terminado correctamente."