Spaces:
Sleeping
Sleeping
HF Spaces Deployment Summary
β Completed
- Dockerized Flask app for Hugging Face Spaces
- Database initialization - auto-creates tables on startup
- Login/Registration - fully functional
- Secrets configuration - SECRET_KEY set in
.env - Logging added - debug auth routes
π§ Current Configuration
- App URL: https://crackbit-ai-learning-path-generator.hf.space
- Port: 7860 (HF Spaces default)
- Workers: 1 worker + 4 threads (prevents CSRF issues)
- Database: SQLite (ephemeral - resets on restart)
- Session: Secure cookies disabled for HF internal HTTP
- CSRF: Temporarily disabled (WTF_CSRF_ENABLED = False)
π Testing Checklist
- Register new user β Should redirect to home with success message
- Login with registered user β Should redirect to home with greeting
- Generate learning path β Should work without login (guest mode)
- Check logs for login/registration messages
β οΈ Known Issues
- Database is ephemeral - User data resets on Space restart
- Fix: Use external database (Supabase, Neon, etc.)
- CSRF disabled - For security, should be re-enabled with session backend
- Fix: Use Flask-Session with Redis or database backend
π Security TODOs
- Remove/regenerate API keys from
.env(currently in git)- Move to HF Space Repository Secrets instead
- Regenerate these keys:
OPENROUTER_API_KEYPERPLEXITY_API_KEY
- Re-enable CSRF with persistent session backend
π File Structure
hf-space/
βββ Dockerfile # HF Spaces compatible
βββ start.sh # Database init + gunicorn startup
βββ requirements.txt # All Python dependencies
βββ .env # Environment variables (move to secrets!)
βββ config.py # Flask configuration
βββ run.py # App entry point
βββ web_app/
β βββ __init__.py # App factory
β βββ auth_routes.py # Login/registration (with logging)
β βββ models.py # Database models
β βββ templates/ # HTML templates
β βββ static/ # CSS, JS
βββ src/ # Learning path generation
βββ backend/ # API routes
βββ migrations/ # Database migrations
π Next Steps
- Test login/registration functionality
- For persistent data, configure external database
- Move secrets from .env to HF Spaces Repository Secrets
- Re-enable CSRF with Flask-Session backend
- Add monitoring/error tracking (Sentry, etc.)