File size: 1,169 Bytes
a08ee99 9b44947 a08ee99 94a151a a08ee99 94a151a a08ee99 |
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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
#!/bin/bash
set -e
echo "=== Starting AI Learning Path Generator ==="
# Set Flask app for migrations
export FLASK_APP=web_app:create_app
# Debug: Check if SECRET_KEY is set
if [ -z "$SECRET_KEY" ]; then
echo "WARNING: SECRET_KEY is not set! Sessions/CSRF will not work properly."
else
echo "SECRET_KEY is configured (length: ${#SECRET_KEY})"
fi
# Check database configuration
if [ -z "$DATABASE_URL" ]; then
echo "WARNING: DATABASE_URL not set. Using local SQLite database (data will be lost on restart)."
echo "To enable persistent storage, set DATABASE_URL to a PostgreSQL connection string."
else
echo "DATABASE_URL is configured (using PostgreSQL for persistent storage)"
fi
# Initialize database if it doesn't exist
echo "Initializing database..."
python -c "
from web_app import create_app
from web_app.models import db
app = create_app()
with app.app_context():
db.create_all()
print('✅ Database initialized')
"
echo "Starting gunicorn server..."
# Use 1 worker to avoid CSRF token mismatch between workers
# Use threads instead for concurrency
exec gunicorn run:app --bind 0.0.0.0:7860 --workers 1 --threads 4 --timeout 120
|