- README.md: Quick start, API endpoints, ports - PROJECT.md: Architecture, components, data models - ROADMAP.md: Version milestones (v0.1.x - v1.0.0) - TASKS.md: Current sprint tasks - TODO.md: Backlog items - docs/INSTALL.md: Setup and deployment - docs/USAGE.md: API examples - docs/CHEATSHEET.md: Quick reference
1.3 KiB
1.3 KiB
Installation
Requirements
- Python 3.11+
- pip
- SQLite (included) or PostgreSQL
Development Setup
# Clone repository
cd ~/git/esp32-web
# Create virtual environment
python3 -m venv .venv
source .venv/bin/activate
# Install with dev dependencies
pip install -e ".[dev]"
# Initialize database
flask --app src/esp32_web db init
flask --app src/esp32_web db migrate -m "initial"
flask --app src/esp32_web db upgrade
# Verify installation
make test
Configuration
Copy .env.example to .env and adjust:
cp .env.example .env
| Variable | Default | Description |
|---|---|---|
| SECRET_KEY | dev-key | Flask secret key |
| DATABASE_URL | sqlite:///esp32.db | Database connection |
| UDP_PORT | 5500 | UDP collector port |
| CMD_PORT | 5501 | Sensor command port |
| SENSOR_TIMEOUT | 60 | Seconds before sensor marked offline |
Container Deployment
# Build image
make build
# Run container
make container-run
# View logs
make container-logs
# Stop container
make container-stop
Production
For production, use gunicorn:
gunicorn -b 0.0.0.0:5500 -w 4 'esp32_web:create_app()'
With PostgreSQL:
export DATABASE_URL="postgresql://user:pass@localhost/esp32web"
flask --app src/esp32_web db upgrade