ENISE Site - Quick Start Guide
What's Been Done β
The ENISE Django application is now production-ready for Hugging Face Spaces deployment. All critical issues have been fixed:
- Security Fixed: Removed exposed MongoDB credentials
- Startup Fixed: Created proper
run.shproduction script - Static Files Fixed: Added WhiteNoise middleware
- Dependencies Fixed: Cleaned up requirements.txt
- Documentation: Complete deployment guide
Current Status
- Repository: https://github.com/tiffank1802/enise-site-2
- HF Space: https://huggingface.co/spaces/ktongue/ENISE
- Code Status: β Ready for production
For Next Steps: Set Up HF Spaces
1. Log in to Hugging Face Spaces
Visit: https://huggingface.co/spaces/ktongue/ENISE
2. Go to Settings
Click the βοΈ Settings button in the top right
3. Set Repository Secrets
Click Repository Secrets and add these variables:
KEY: DEBUG
VALUE: False
KEY: SECRET_KEY
VALUE: 7h8922w$d%%%)fdzmka8ny^*o(o5dv7=x95^%yd0*t7dh5-hh@
KEY: ALLOWED_HOSTS
VALUE: *
KEY: CSRF_TRUSTED_ORIGINS
VALUE: https://ktongue-enise.hf.space,http://localhost:7860
KEY: APPWRITE_ENDPOINT
VALUE: https://cloud.appwrite.io/v1
KEY: APPWRITE_PROJECT_ID
VALUE: <your-project-id-from-appwrite>
KEY: APPWRITE_API_KEY
VALUE: <your-api-key-from-appwrite>
KEY: APPWRITE_DATABASE_ID
VALUE: enise_db
4. Wait for Auto-Deployment
The space will automatically rebuild and deploy. Check the Logs to see the build progress.
5. Verify It's Working
Once deployed, visit:
- Homepage: https://ktongue-enise.hf.space/
- Formations: https://ktongue-enise.hf.space/formations/
- API Test: https://ktongue-enise.hf.space/api/appwrite/test/
Key Files
| File | Purpose |
|---|---|
requirements.txt |
Python dependencies |
Dockerfile |
Container configuration for HF Spaces |
run.sh |
Production startup script |
enise_site/settings.py |
Django configuration |
enise_site/wsgi.py |
WSGI application entry point |
DEPLOYMENT_CHECKLIST.md |
Complete deployment verification guide |
FIXES_APPLIED.md |
Details of all fixes made |
Project Structure
enise-site/
βββ enise_site/ # Main Django project
β βββ settings.py # Configuration
β βββ urls.py # URL routing
β βββ wsgi.py # WSGI entry point
β βββ asgi.py # ASGI entry point
βββ app_core/ # Main app with models
β βββ views.py # Views
β βββ urls.py # URL patterns
β βββ models.py # Database models
β βββ templates/ # HTML templates
βββ app_formations/ # Formations app
βββ manage.py # Django management
βββ run.sh # Production startup script
βββ Dockerfile # Docker configuration
βββ requirements.txt # Dependencies
Features
Core Features Implemented:
- β Homepage with ENISE branding
- β Formations/Programs listing
- β Appwrite integration for data
- β File management system
- β User authentication
- β MongoDB file storage (optional)
- β Static file serving with WhiteNoise
- β Production-ready configuration
Appwrite Collections:
specialites- Programs/Specialtiesactualites- News/Updatescontact- Contact form submissionspartenaires- Academic partnersstatistiques- School statistics
Troubleshooting
Space shows "Building" for too long:
- Check if there's a compilation error
- Click Logs tab to see build output
- Check if all environment variables are set
HTTP 400 Error:
- Verify
SECRET_KEYis set in secrets - Check
ALLOWED_HOSTSincludes the HF domain - Verify
DEBUG=Falseis set - Check CSRF settings
Static files not loading:
- WhiteNoise middleware is enabled β
- run.sh runs
collectstaticautomatically β - Check logs for file serving errors
Appwrite connection failed:
- Verify credentials in HF Secrets
- Check Appwrite project exists
- Verify API key has necessary permissions
Contact & Support
- Project Repository: https://github.com/tiffank1802/enise-site-2
- Documentation: See
DEPLOYMENT_CHECKLIST.md - Issues: Create an issue in GitHub
Last Updated: Jan 30, 2025
Status: Production Ready β