This repository has been archived on 2026-09-04. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
theme-song-booth/init_db.py

25 lines
584 B
Python

"""
init_db.py
==========
Standalone script to create the SQLite database tables.
Run this once inside the container after deployment:
python init_db.py
Or use the Flask CLI command:
flask --app app init-db
"""
import os
import sys
# Ensure the project root is on sys.path so `from app import app` works.
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from app import app
from models import init_db
# Use the configured database path and create tables.
with app.app_context():
init_db()
print(f"Database initialized at {app.config['DATABASE']}")