diff --git a/blog/bp/blog/ghost/ghost_sync.py b/blog/bp/blog/ghost/ghost_sync.py index dd6d60c..0c97f14 100644 --- a/blog/bp/blog/ghost/ghost_sync.py +++ b/blog/bp/blog/ghost/ghost_sync.py @@ -248,13 +248,24 @@ async def _upsert_post(sess: AsyncSession, gp: Dict[str, Any], author_map: Dict[ finally: sess.autoflush = old_autoflush - # Auto-create PageConfig for pages (blog now owns this table) + # Auto-create PageConfig for pages (blog owns this table — direct DB, + # not via HTTP, since this may run during startup before the server is ready) if obj.is_page: - await fetch_data( - "blog", "page-config-ensure", - params={"container_type": "page", "container_id": obj.id}, - required=False, - ) + from sqlalchemy import select + from shared.models.page_config import PageConfig + existing = (await sess.execute( + select(PageConfig).where( + PageConfig.container_type == "page", + PageConfig.container_id == obj.id, + ) + )).scalar_one_or_none() + if existing is None: + sess.add(PageConfig( + container_type="page", + container_id=obj.id, + features={}, + )) + await sess.flush() return obj, old_status