def kakaoSignup(request):
    access_token = request.headers['Authorization']
    profile_request = requests.post('https://kapi.kakao.com/v2/user/me', headers={'Authorization': f'Bearer {access_token}'})
    profile_json = profile_request.json()
    kakao_id = profile_request.json().get('id')
    print('profile_json : ', profile_json)
    kakao_account = profile_json.get('kakao_account')
    print('kakao_account : ', kakao_account)
    email = kakao_account.get('email', None)
    profile = kakao_account.get('profile')
    print('profile : ', profile)
    nickname = profile.get('nickname')
    profile_image = profile.get('profile_image_url')
    data = {'access_token': access_token}
    accept = requests.post('http://localhost:8000/accounts/rest-auth/kakao/', data=data)
    accept_json = accept.json()
    print(accept_json)
    accept_jwt = accept_json.get('token')
    try:
        user = User.objects.get(kakao_id=kakao_id)
        return JsonResponse({'access_token': accept_jwt, 'name': nickname, 'image': profile_image, 'is_corrector': user.is_corrector, 'is_phone_auth': user.is_phone_auth}, status=200)
    except User.DoesNotExist:
        User.objects.filter(email=email).update(kakao_id=kakao_id, name=nickname, thumbnail_image=profile_image)
        user = User.objects.get(kakao_id=kakao_id)
        return JsonResponse({'access_token': accept_jwt, 'name': nickname, 'image': profile_image, 'is_corrector': user.is_corrector, 'is_phone_auth': user.is_phone_auth}, status=200)
def kakaoSignup(request):
    access_token = request.headers['Authorization']
    profile_request = requests.post('https://kapi.kakao.com/v2/user/me', headers={'Authorization': f'Bearer {access_token}'})
    profile_json = profile_request.json()
    kakao_id = profile_request.json().get('id')
    print('profile_json : ', profile_json)
    kakao_account = profile_json.get('kakao_account')
    print('kakao_account : ', kakao_account)
    email = kakao_account.get('email', None)
    profile = kakao_account.get('profile')
    print('profile : ', profile)
    nickname = profile.get('nickname')
    profile_image = profile.get('profile_image_url')
    data = {'access_token': access_token}
    accept = requests.post('http://localhost:8000/accounts/rest-auth/kakao/', data=data)
    accept_json = accept.json()
    print(accept_json)
    accept_jwt = accept_json.get('token')
    try:
        user = User.objects.get(kakao_id=kakao_id)
        return JsonResponse({'access_token': accept_jwt, 'name': nickname, 'image': profile_image, 'is_corrector': user.is_corrector, 'is_phone_auth': user.is_phone_auth}, status=200)
    except User.DoesNotExist:
        User.objects.filter(email=email).update(kakao_id=kakao_id, name=nickname, thumbnail_image=profile_image)
        user = User.objects.get(kakao_id=kakao_id)
        return JsonResponse({'access_token': accept_jwt, 'name': nickname, 'image': profile_image, 'is_corrector': user.is_corrector, 'is_phone_auth': user.is_phone_auth}, status=200)