django bacekdn opeartioanl fixes and site wp integration api fixes
This commit is contained in:
@@ -61,8 +61,8 @@ def publish_content_to_wordpress(self, content_id: int, site_integration_id: int
|
||||
site_domain = base_url.replace('https://', '').replace('http://', '').split('/')[0] if base_url else 'unknown'
|
||||
log_prefix = f"[{site_id}-{site_domain}]"
|
||||
|
||||
# Extract API key from credentials
|
||||
api_key = site_integration.get_credentials().get('api_key', '')
|
||||
# API key is stored in Site.wp_api_key (SINGLE source of truth)
|
||||
api_key = site_integration.site.wp_api_key or ''
|
||||
|
||||
publish_logger.info(f" ✅ Content loaded:")
|
||||
publish_logger.info(f" {log_prefix} Title: '{content.title}'")
|
||||
@@ -258,7 +258,8 @@ def publish_content_to_wordpress(self, content_id: int, site_integration_id: int
|
||||
|
||||
# STEP 8: Send API request to WordPress
|
||||
base_url = site_integration.config_json.get('site_url', '') or site_integration.config_json.get('base_url', '')
|
||||
api_key = site_integration.get_credentials().get('api_key', '')
|
||||
# API key is stored in Site.wp_api_key (SINGLE source of truth)
|
||||
api_key = site_integration.site.wp_api_key or ''
|
||||
|
||||
if not base_url:
|
||||
error_msg = "No base_url/site_url configured in integration"
|
||||
@@ -266,7 +267,7 @@ def publish_content_to_wordpress(self, content_id: int, site_integration_id: int
|
||||
return {"success": False, "error": error_msg}
|
||||
|
||||
if not api_key:
|
||||
error_msg = "No API key configured in integration"
|
||||
error_msg = "No API key configured for site. Generate one in Site Settings."
|
||||
publish_logger.error(f" {log_prefix} ❌ {error_msg}")
|
||||
return {"success": False, "error": error_msg}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user