from django.http import JsonResponse def leaderboard_view(request): response = JsonResponse({'data': 'your data'}) response["Access-Control-Allow-Origin"] = "http://localhost:8000" return response