Spaces:
Runtime error
Runtime error
File size: 581 Bytes
990fad0 4aa8e11 990fad0 4aa8e11 990fad0 4aa8e11 990fad0 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | #!/bin/sh
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" |