Add comprehensive comments to all source files and expand documentation
This commit is contained in:
parent
9e532a1920
commit
b4f0222bd5
16 changed files with 1230 additions and 552 deletions
15
init_db.py
15
init_db.py
|
|
@ -1,12 +1,25 @@
|
|||
"""
|
||||
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 project root is importable
|
||||
# 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']}")
|
||||
|
|
|
|||
Reference in a new issue