Calling a django function view from an aws lambda function

孤街醉人 提交于 2020-06-29 03:50:22

问题


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?

来源:https://stackoverflow.com/questions/62427304/calling-a-django-function-view-from-an-aws-lambda-function

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!