diff --git a/.gitignore b/.gitignore index cfe5a23..0299c45 100644 --- a/.gitignore +++ b/.gitignore @@ -12,8 +12,9 @@ env/ ENV/ # ── Database ────────────────────────────────────────────────────────────────── -# The live database is never committed – only cpu_specs is preserved via the -# bundled seed dump (if one is created). See purge_db.py before committing. +# The live database is never committed. seed.db (cpu_specs only) IS committed +# and serves as the starting point for new users. Regenerate it with: +# python _dev/export_seed_db.py database.db database.db-shm database.db-wal @@ -26,7 +27,6 @@ logs/ browser_data/ # ── Maintenance / dev scripts (not part of the shipped app) ────────────────── -purge_db.py _dev/ # ── OS / editor noise ───────────────────────────────────────────────────────── diff --git a/main.py b/main.py index bc6b303..32d2893 100644 --- a/main.py +++ b/main.py @@ -29,6 +29,14 @@ from scrapers.shared import init_db, DB_PATH as _SCRAPER_DB_PATH # ── Flask app ───────────────────────────────────────────────────────────────── DB_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), "database.db") +SEED_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), "seed.db") + +# ── Seed bootstrap ──────────────────────────────────────────────────────────── +# On first run, if no database exists yet but a seed.db is bundled, copy it +# into place so users start with pre-populated CPU data. +if not os.path.exists(DB_PATH) and os.path.exists(SEED_PATH): + import shutil + shutil.copy2(SEED_PATH, DB_PATH) app = Flask(__name__, static_folder="static", static_url_path="/static") diff --git a/seed.db b/seed.db new file mode 100644 index 0000000..91174f2 Binary files /dev/null and b/seed.db differ