Calling a django function view from an aws lambda function

Viewed 888

I want to run my django views on AWS Lambda. For this I had created a lambda function which is calling that view function. The AWS lambda function is something like this ->

import app.views as v

def functionA_handler(event, context): 

    some_value = v.functionA(event)
    return some_value

The corresponding view in app.views file would be something like this ->

from django.views.decorators.csrf import csrf_exempt
from django.http import JsonResponse, HttpResponse
@csrf_exempt
def functionA(request):
  request_body = json.loads(request.body)
  return JsonResponse(request_body, status=200)

How can I link the above lambda function to the view function? The view takes an input of the form request which is creating an issue here. Any solution?

0 Answers
Related