Spaces:
Runtime error
Runtime error
| set -e | |
| # Build DATABASE_URL from individual env vars | |
| export DATABASE_URL="sqlite:///${DATABASE_NAME}.db" | |
| # Initialize migrations if not present, and patch env.py for SQLite batch mode | |
| if [ ! -d "migrations" ]; then | |
| flask db init | |
| sed -i \ | |
| 's/context.configure(/context.configure(\n render_as_batch=True,/' \ | |
| migrations/env.py | |
| fi | |
| # Apply all migrations | |
| flask db upgrade | |
| # Start the app | |
| exec gunicorn \ | |
| --bind 0.0.0.0:${PORT:-5000} \ | |
| --workers 4 \ | |
| --timeout 120 \ | |
| --access-logfile - \ | |
| --error-logfile - \ | |
| "main:app" |