mirror of
https://github.com/thecyberlearn/quantumtaskai-caprover.git
synced 2026-08-18 19:32:56 +00:00
Fix health check endpoint - resolve 301 redirect issues
- Add missing redirect import in core/views.py - Remove broken AgentFileService dependency from health check - Clean up duplicate imports - Health check now returns HTTP 200 OK instead of 301 redirects - Fixes CapRover health check failures
This commit is contained in:
parent
43e4570792
commit
648bd0e68e
@ -1,16 +1,13 @@
|
|||||||
from django.shortcuts import render
|
from django.shortcuts import render, redirect
|
||||||
from django.http import JsonResponse
|
from django.http import JsonResponse, Http404
|
||||||
from django.db import connection
|
from django.db import connection
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from django.http import JsonResponse, Http404
|
|
||||||
from django.core.mail import send_mail
|
from django.core.mail import send_mail
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
# from django_ratelimit.decorators import ratelimit
|
# from django_ratelimit.decorators import ratelimit
|
||||||
# from django_ratelimit import UNSAFE
|
# from django_ratelimit import UNSAFE
|
||||||
# AgentFileService import removed since homepage redirects to marketplace
|
|
||||||
from .models import ContactSubmission
|
from .models import ContactSubmission
|
||||||
from django.db import connection
|
|
||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
import time
|
import time
|
||||||
@ -212,18 +209,18 @@ def health_check_view(request):
|
|||||||
'response_time_ms': round((time.time() - start_time) * 1000, 2)
|
'response_time_ms': round((time.time() - start_time) * 1000, 2)
|
||||||
}
|
}
|
||||||
|
|
||||||
# If database is working, get agent count from files
|
# If database is working, add basic agent system check
|
||||||
try:
|
try:
|
||||||
active_agents = AgentFileService.get_active_agents()
|
# Simple check - we can import the agents module
|
||||||
agent_count = len(active_agents)
|
import agents
|
||||||
health_data['checks']['agents'] = {
|
health_data['checks']['agents'] = {
|
||||||
'status': 'healthy',
|
'status': 'healthy',
|
||||||
'active_count': agent_count
|
'system_available': True
|
||||||
}
|
}
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
health_data['checks']['agents'] = {
|
health_data['checks']['agents'] = {
|
||||||
'status': 'warning',
|
'status': 'warning',
|
||||||
'error': 'Could not load agents',
|
'error': 'Agents module not available',
|
||||||
'message': str(e)[:100]
|
'message': str(e)[:100]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user