| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- else
- echo -e "${GREEN}✅ Environnement virtuel existe déjà${NC}"
- fi
- # Étape 2 : Activation et installation des dépendances
- echo -e "\n${YELLOW}📦 Étape 2/5 : Installation des dépendances...${NC}"
- source venv/bin/activate
- pip install --upgrade pip
- pip install -r requirements.txt
- if [ $? -eq 0 ]; then
- echo -e "${GREEN}✅ Dépendances installées${NC}"
- else
- echo -e "${RED}❌ Erreur lors de l'installation des dépendances${NC}"
- exit 1
- fi
- # Étape 3 : Vérification du fichier .env
- echo -e "\n${YELLOW}🔐 Étape 3/5 : Vérification de la configuration...${NC}"
- if [ ! -f ".env" ]; then
- echo -e "${RED}❌ Fichier .env manquant !${NC}"
- echo "Copiez .env.example vers .env et configurez-le"
- exit 1
- else
- echo -e "${GREEN}✅ Fichier .env trouvé${NC}"
- fi
- # Étape 4 : Migrations
- echo -e "\n${YELLOW}🗄️ Étape 4/5 : Application des migrations...${NC}"
- python manage.py makemigrations
- python manage.py migrate
- if [ $? -eq 0 ]; then
- echo -e "${GREEN}✅ Migrations appliquées${NC}"
- else
- echo -e "${RED}❌ Erreur lors des migrations${NC}"
- exit 1
- fi
- # Étape 5 : Collecte des fichiers statiques (optionnel en dev)
- echo -e "\n${YELLOW}📁 Étape 5/5 : Fichiers statiques...${NC}"
- echo "Voulez-vous collecter les fichiers statiques ? (o/N)"
- read -r response
- if [[ "$response" =~ ^([oO][uU][iI]|[oO])$ ]]; then
- python manage.py collectstatic --noinput
- echo -e "${GREEN}✅ Fichiers statiques collectés${NC}"
- else
- echo -e "${YELLOW}⏭️ Fichiers statiques ignorés${NC}"
- fi
- echo -e "\n${GREEN}=============================================="
- echo "✅ Installation terminée avec succès !"
- echo "=============================================="
- echo -e "${NC}"
- echo "Pour démarrer le serveur :"
- echo " source venv/bin/activate"
- echo " python manage.py runserver"
- echo ""
- echo "Puis visitez : http://127.0.0.1:8000/blog/"
|