问题描述
zappa可以轻松地用于运行flask应用程序.但每个应用程序仅创建一个lambda函数.我声明的每个python函数都可以有一个单独的lambda函数吗?
zappa can easily be used to run flask apps. But it creates just one lambda function per app. Can I have a separate lambda function for each python function I declare?
推荐答案
由于这是您在搜索 zappa中的非wsgi 时获得的第一个SO结果,因此我将分摊2美分.
Since this is the first SO result that you get when searching for zappa for non-wsgi I'll share my 2 cents.
如果您只想使用Zappa部署到AWS Lambda并能够实际上不使用WSGI来调用功能而无需,则可以执行以下操作:
If you just want use Zappa to deploy to AWS Lambda and be able to invoke your function without actually using WSGI you can do something like this:
def foo(event, context):
print('foo bar')
return 'lambda triggered!'
zappa_settings.json
{
"dev": {
"lambda_handler": "myapp.foo",
...
}
}
现在转到浏览器中的AWS Lambda控制台,然后单击 Test 并查看正在触发的功能.
Now go to your AWS Lambda console in browser and click Test and see the function being triggered.
这篇关于zappa可以用于直接运行功能(非wsgi应用程序)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!