Fix Paperless integration: use internal Docker network URL (http://paperless:8000) + improved error handling
This commit is contained in:
@@ -99,7 +99,7 @@ CELERY_BROKER_URL = os.getenv("REDIS_URL", "redis://redis:6379/0")
|
|||||||
CELERY_RESULT_BACKEND = os.getenv("REDIS_URL", "redis://redis:6379/0")
|
CELERY_RESULT_BACKEND = os.getenv("REDIS_URL", "redis://redis:6379/0")
|
||||||
|
|
||||||
# Paperless
|
# Paperless
|
||||||
PAPERLESS_API_URL = os.getenv("PAPERLESS_API_URL", "http://192.168.178.167:30070")
|
PAPERLESS_API_URL = os.getenv("PAPERLESS_API_URL", "http://paperless:8000")
|
||||||
PAPERLESS_API_TOKEN = os.getenv("PAPERLESS_API_TOKEN")
|
PAPERLESS_API_TOKEN = os.getenv("PAPERLESS_API_TOKEN")
|
||||||
PAPERLESS_REQUIRED_TAG = os.getenv("PAPERLESS_REQUIRED_TAG", "Stiftung_Destinatäre")
|
PAPERLESS_REQUIRED_TAG = os.getenv("PAPERLESS_REQUIRED_TAG", "Stiftung_Destinatäre")
|
||||||
PAPERLESS_LAND_TAG = os.getenv("PAPERLESS_LAND_TAG", "Stiftung_Land_und_Pächter")
|
PAPERLESS_LAND_TAG = os.getenv("PAPERLESS_LAND_TAG", "Stiftung_Land_und_Pächter")
|
||||||
|
|||||||
@@ -2641,10 +2641,21 @@ def paperless_documents(request):
|
|||||||
)
|
)
|
||||||
|
|
||||||
except requests.exceptions.RequestException as e:
|
except requests.exceptions.RequestException as e:
|
||||||
|
import logging
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
logger.error(f"Paperless API request failed: {e}")
|
||||||
|
logger.error(f"Paperless API URL: {base_url}")
|
||||||
|
logger.error(f"Token configured: {'Yes' if token else 'No'}")
|
||||||
|
|
||||||
return Response(
|
return Response(
|
||||||
{
|
{
|
||||||
"error": f"API-Fehler: {e}",
|
"error": f"API-Fehler: {e}",
|
||||||
"message": "Could not connect to Paperless API. Please check your configuration.",
|
"message": f"Could not connect to Paperless API at {base_url}. Please check your configuration.",
|
||||||
|
"debug_info": {
|
||||||
|
"api_url": base_url,
|
||||||
|
"has_token": bool(token),
|
||||||
|
"error_type": type(e).__name__
|
||||||
|
},
|
||||||
"documents": [],
|
"documents": [],
|
||||||
"total_destinaere": 0,
|
"total_destinaere": 0,
|
||||||
"total_land": 0,
|
"total_land": 0,
|
||||||
|
|||||||
Reference in New Issue
Block a user