dippoo Claude Opus 4.6 commited on
Commit
b341f22
·
1 Parent(s): 2d79152

Add debug logging for DB path on startup

Browse files

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

src/content_engine/models/database.py CHANGED
@@ -178,13 +178,17 @@ class TrainingJob(Base):
178
 
179
  # --- Engine / Session factories ---
180
 
181
- # Ensure database directories exist
 
182
  from pathlib import Path as _Path
183
- _db_path = settings.database.url.replace("sqlite+aiosqlite:///", "")
184
- _Path(_db_path).parent.mkdir(parents=True, exist_ok=True)
 
 
 
185
 
186
  _catalog_engine = create_async_engine(
187
- settings.database.url,
188
  echo=False,
189
  connect_args={"check_same_thread": False}, # SQLite specific
190
  )
 
178
 
179
  # --- Engine / Session factories ---
180
 
181
+ # Ensure database directories exist (critical for HF Spaces first run)
182
+ import logging as _logging
183
  from pathlib import Path as _Path
184
+ _db_url = settings.database.url
185
+ _db_path = _db_url.replace("sqlite+aiosqlite:///", "")
186
+ _db_dir = _Path(_db_path).parent
187
+ _db_dir.mkdir(parents=True, exist_ok=True)
188
+ _logging.getLogger(__name__).info("DB path: %s (dir exists: %s)", _db_path, _db_dir.exists())
189
 
190
  _catalog_engine = create_async_engine(
191
+ _db_url,
192
  echo=False,
193
  connect_args={"check_same_thread": False}, # SQLite specific
194
  )