add endpoint to ping server, and display log if connection fails

This commit is contained in:
Joel Mathew Thomas
2025-03-19 18:10:47 +05:30
parent 1e9fceb0dc
commit 40f64b152c
3 changed files with 31 additions and 7 deletions
+6 -1
View File
@@ -21,7 +21,12 @@ UPLOAD_DIR = "/tmp/freqsplit"
# Ensure the temp directory exists
os.makedirs(UPLOAD_DIR, exist_ok=True)
#
# Endpoint to ping server
@api_view(['GET'])
def ping(request):
"""Endpoint to ping the server"""
if (request):
return Response(status=status.HTTP_200_OK);
# Endpoint to upload audio and classify it to audio_class
@api_view(['POST'])
+2
View File
@@ -16,6 +16,7 @@ Including another URLconf
"""
from django.contrib import admin
from django.urls import path
from api.views import ping
from api.views import upload_audio
from api.views import normalize_audio
from api.views import trim_audio
@@ -28,6 +29,7 @@ from api.views import cleanup
from api.views import cleanup_zip
urlpatterns = [
path('api/ping', ping, name="ping"),
path('admin/', admin.site.urls),
path('api/upload', upload_audio, name='upload_audio'),
path('api/normalize', normalize_audio, name="normalize_audio"),