tiffank1802 commited on
Commit ·
51bb26f
1
Parent(s): f2d53ec
Add comprehensive production README
Browse files- Overview of ENISE Site project and deployment
- Quick deployment instructions
- Complete technology stack overview
- Security best practices
- Troubleshooting guide
- Monitoring and update procedures
- README_PRODUCTION.md +231 -0
README_PRODUCTION.md
ADDED
|
@@ -0,0 +1,231 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ENISE Site - Production Deployment Guide
|
| 2 |
+
|
| 3 |
+
## 📋 Sommaire
|
| 4 |
+
|
| 5 |
+
Ce repository contient l'application ENISE Site - une plateforme web Django pour l'école d'ingénieurs ENISE, déployée sur Hugging Face Spaces avec intégration Appwrite.
|
| 6 |
+
|
| 7 |
+
- **Repository**: https://github.com/tiffank1802/enise-site-2
|
| 8 |
+
- **HF Space**: https://huggingface.co/spaces/ktongue/ENISE
|
| 9 |
+
- **Framework**: Django 5.0
|
| 10 |
+
- **Backend**: Appwrite Cloud
|
| 11 |
+
- **Deployment**: Docker sur HF Spaces
|
| 12 |
+
|
| 13 |
+
## ✨ Caractéristiques
|
| 14 |
+
|
| 15 |
+
### ✅ Implémentées
|
| 16 |
+
- Homepage avec branding ENISE
|
| 17 |
+
- Listing des formations/spécialisations
|
| 18 |
+
- Intégration Appwrite pour les données
|
| 19 |
+
- Système de gestion des fichiers
|
| 20 |
+
- Authentification utilisateur
|
| 21 |
+
- Stockage MongoDB (optionnel)
|
| 22 |
+
- Fichiers statiques avec WhiteNoise
|
| 23 |
+
- Configuration production-ready
|
| 24 |
+
- Documentation complète
|
| 25 |
+
|
| 26 |
+
### 🗄️ Collections Appwrite Disponibles
|
| 27 |
+
- `specialites` - Programs/Specialties
|
| 28 |
+
- `actualites` - News/Updates
|
| 29 |
+
- `contact` - Contact form submissions
|
| 30 |
+
- `partenaires` - Academic partners
|
| 31 |
+
- `statistiques` - School statistics
|
| 32 |
+
|
| 33 |
+
## 🚀 Déploiement Rapide
|
| 34 |
+
|
| 35 |
+
### 1️⃣ Configuration sur HF Spaces
|
| 36 |
+
|
| 37 |
+
1. Visitez: https://huggingface.co/spaces/ktongue/ENISE
|
| 38 |
+
2. Cliquez **⚙️ Settings**
|
| 39 |
+
3. Allez à **Repository Secrets**
|
| 40 |
+
4. Ajoutez ces variables (voir `QUICK_START.md` pour valeurs):
|
| 41 |
+
|
| 42 |
+
```
|
| 43 |
+
DEBUG=False
|
| 44 |
+
SECRET_KEY=<votre-clé>
|
| 45 |
+
ALLOWED_HOSTS=*
|
| 46 |
+
CSRF_TRUSTED_ORIGINS=https://ktongue-enise.hf.space
|
| 47 |
+
APPWRITE_ENDPOINT=https://fra.cloud.appwrite.io/v1
|
| 48 |
+
APPWRITE_PROJECT_ID=<votre-id>
|
| 49 |
+
APPWRITE_API_KEY=<votre-clé> ⚠️
|
| 50 |
+
APPWRITE_DATABASE_ID=<votre-db-id>
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
### 2️⃣ Vérification
|
| 54 |
+
|
| 55 |
+
Une fois configuré, le space se redémarrera automatiquement.
|
| 56 |
+
|
| 57 |
+
Testez les endpoints:
|
| 58 |
+
- Homepage: https://ktongue-enise.hf.space/
|
| 59 |
+
- Formations: https://ktongue-enise.hf.space/formations/
|
| 60 |
+
- API: https://ktongue-enise.hf.space/api/appwrite/test/
|
| 61 |
+
|
| 62 |
+
Voir `VERIFIER_DEPLOIEMENT.md` pour guide complet.
|
| 63 |
+
|
| 64 |
+
## 📚 Documentation
|
| 65 |
+
|
| 66 |
+
| Document | Purpose |
|
| 67 |
+
|----------|---------|
|
| 68 |
+
| `QUICK_START.md` | Démarrage rapide |
|
| 69 |
+
| `DEPLOYMENT_CHECKLIST.md` | Checklist complète |
|
| 70 |
+
| `VERIFIER_DEPLOIEMENT.md` | Guide vérification (FR) |
|
| 71 |
+
| `DEPLOYMENT_STATUS.md` | État du déploiement |
|
| 72 |
+
| `FIXES_APPLIED.md` | Corrections appliquées |
|
| 73 |
+
|
| 74 |
+
## 🔧 Technologies
|
| 75 |
+
|
| 76 |
+
| Composant | Version |
|
| 77 |
+
|-----------|---------|
|
| 78 |
+
| Python | 3.11+ |
|
| 79 |
+
| Django | 5.0+ |
|
| 80 |
+
| Appwrite | 1.0+ |
|
| 81 |
+
| WhiteNoise | 6.5+ |
|
| 82 |
+
| PostgreSQL | optionnel |
|
| 83 |
+
|
| 84 |
+
## 📊 Structure du Projet
|
| 85 |
+
|
| 86 |
+
```
|
| 87 |
+
enise-site/
|
| 88 |
+
├── enise_site/ # Django project
|
| 89 |
+
│ ├── settings.py # Configuration
|
| 90 |
+
│ ├── urls.py # URL routing
|
| 91 |
+
│ └── wsgi.py # WSGI entry
|
| 92 |
+
├── app_core/ # Main application
|
| 93 |
+
│ ├── models.py # ORM models
|
| 94 |
+
│ ├── views.py # Views
|
| 95 |
+
│ ├── urls.py # Routes
|
| 96 |
+
│ └── templates/ # HTML templates
|
| 97 |
+
├── app_formations/ # Formations app
|
| 98 |
+
├── static/ # CSS, JS, images
|
| 99 |
+
├── media/ # User uploads
|
| 100 |
+
├── Dockerfile # Docker config
|
| 101 |
+
├── run.sh # Startup script
|
| 102 |
+
├── requirements.txt # Dependencies
|
| 103 |
+
└── manage.py # Django CLI
|
| 104 |
+
```
|
| 105 |
+
|
| 106 |
+
## 🔐 Configuration de Sécurité
|
| 107 |
+
|
| 108 |
+
### ✅ Appliquée
|
| 109 |
+
- Credentials MongoDB supprimées ✓
|
| 110 |
+
- SECRET_KEY en variables d'env ✓
|
| 111 |
+
- DEBUG=False en production ✓
|
| 112 |
+
- WhiteNoise pour fichiers statiques ✓
|
| 113 |
+
- CSRF protection configurée ✓
|
| 114 |
+
- API keys en HF Secrets ✓
|
| 115 |
+
|
| 116 |
+
### ⚠️ À Faire
|
| 117 |
+
- Jamais committer `.env`
|
| 118 |
+
- Régénérer SECRET_KEY pour chaque deployment
|
| 119 |
+
- Utiliser HTTPS en production
|
| 120 |
+
- Limiter ALLOWED_HOSTS si besoin
|
| 121 |
+
|
| 122 |
+
## 🧪 Tests
|
| 123 |
+
|
| 124 |
+
### Tests Locaux
|
| 125 |
+
|
| 126 |
+
```bash
|
| 127 |
+
# Vérifier configuration
|
| 128 |
+
python manage.py check
|
| 129 |
+
|
| 130 |
+
# Tester déploiement
|
| 131 |
+
python test_deployment.py
|
| 132 |
+
|
| 133 |
+
# Vérifier variables d'env
|
| 134 |
+
python check_env.py
|
| 135 |
+
```
|
| 136 |
+
|
| 137 |
+
### Tests HF Spaces
|
| 138 |
+
|
| 139 |
+
1. Vérifier status "Running"
|
| 140 |
+
2. Tester endpoints (voir `VERIFIER_DEPLOIEMENT.md`)
|
| 141 |
+
3. Vérifier logs en cas d'erreur
|
| 142 |
+
|
| 143 |
+
## 🚨 Dépannage
|
| 144 |
+
|
| 145 |
+
### Space "Building"
|
| 146 |
+
- C'est normal, attendez 5-10 minutes
|
| 147 |
+
- Vérifiez logs si > 15 min
|
| 148 |
+
|
| 149 |
+
### HTTP 400
|
| 150 |
+
- Vérifier `SECRET_KEY` configurée
|
| 151 |
+
- Vérifier `ALLOWED_HOSTS=*`
|
| 152 |
+
- Vérifier `DEBUG=False`
|
| 153 |
+
|
| 154 |
+
### API Appwrite échoue
|
| 155 |
+
- Vérifier `APPWRITE_API_KEY`
|
| 156 |
+
- Vérifier IDs du projet/database
|
| 157 |
+
- Régénérer clé si besoin
|
| 158 |
+
|
| 159 |
+
### Files statiques ne chargent pas
|
| 160 |
+
- WhiteNoise est activé ✓
|
| 161 |
+
- Vérifier `.log` pour erreurs
|
| 162 |
+
- Redémarrer le space
|
| 163 |
+
|
| 164 |
+
Voir `VERIFIER_DEPLOIEMENT.md` pour plus de solutions.
|
| 165 |
+
|
| 166 |
+
## 📈 Monitoring
|
| 167 |
+
|
| 168 |
+
Vérifiez régulièrement:
|
| 169 |
+
|
| 170 |
+
1. **Status du Space**: https://huggingface.co/spaces/ktongue/ENISE
|
| 171 |
+
2. **Logs**: Settings → Logs
|
| 172 |
+
3. **Endpoints**: Tester régulièrement
|
| 173 |
+
4. **Errors**: Chercher "ERROR" dans les logs
|
| 174 |
+
|
| 175 |
+
## 🔄 Mise à Jour
|
| 176 |
+
|
| 177 |
+
Pour déployer une mise à jour:
|
| 178 |
+
|
| 179 |
+
```bash
|
| 180 |
+
# 1. Faire changements localement
|
| 181 |
+
# 2. Tester localement
|
| 182 |
+
python manage.py check
|
| 183 |
+
|
| 184 |
+
# 3. Commit et push
|
| 185 |
+
git add .
|
| 186 |
+
git commit -m "Description"
|
| 187 |
+
git push origin main
|
| 188 |
+
|
| 189 |
+
# 4. HF Spaces redéploie automatiquement
|
| 190 |
+
# 5. Vérifier logs et endpoints
|
| 191 |
+
```
|
| 192 |
+
|
| 193 |
+
## 📞 Support
|
| 194 |
+
|
| 195 |
+
- **Issues**: https://github.com/tiffank1802/enise-site-2/issues
|
| 196 |
+
- **Docs**: Voir fichiers `*.md` dans le repo
|
| 197 |
+
- **Appwrite**: https://console.appwrite.io
|
| 198 |
+
|
| 199 |
+
## 📝 Notes Importantes
|
| 200 |
+
|
| 201 |
+
1. **Credentials**: Ne jamais committer secrets
|
| 202 |
+
2. **Branches**: Main = production, utilisez branches pour dev
|
| 203 |
+
3. **Migrations**: Auto-exécutées par `run.sh`
|
| 204 |
+
4. **Static Files**: Auto-collectés par `run.sh`
|
| 205 |
+
5. **Logs**: Disponibles dans HF Spaces Settings
|
| 206 |
+
|
| 207 |
+
## ✅ Dernière Vérification
|
| 208 |
+
|
| 209 |
+
Avant de considérer le déploiement comme "done":
|
| 210 |
+
|
| 211 |
+
- [ ] Space status = "Running"
|
| 212 |
+
- [ ] Pas d'erreurs dans les logs
|
| 213 |
+
- [ ] Homepage charge (200 OK)
|
| 214 |
+
- [ ] Formations visibles
|
| 215 |
+
- [ ] API test répond
|
| 216 |
+
- [ ] Static files chargent
|
| 217 |
+
- [ ] Admin panel accessible
|
| 218 |
+
- [ ] Appwrite connecté (avec API Key)
|
| 219 |
+
|
| 220 |
+
## 📊 Status
|
| 221 |
+
|
| 222 |
+
- **Code**: ✅ Production-ready
|
| 223 |
+
- **Tests**: ✅ Tous passent
|
| 224 |
+
- **Documentation**: ✅ Complète
|
| 225 |
+
- **Deployment**: ✅ Prêt
|
| 226 |
+
|
| 227 |
+
**Dernière mise à jour**: Jan 30, 2025
|
| 228 |
+
|
| 229 |
+
---
|
| 230 |
+
|
| 231 |
+
Pour commencer, consultez `QUICK_START.md` ou `VERIFIER_DEPLOIEMENT.md`.
|