aws lambda与flask web框架的简单集成。
flask-serverless的Python项目详细描述
快速启动
要快速创建新的无服务器烧瓶应用程序:
- 安装pipenv和aws sam local并生成应用程序模板:
pip install aws-sam-cli pipenv sam init --location https://github.com/aws-samples/cookiecutter-aws-sam-python
- 添加
flask_serverless
依赖项
cd MyApp
make install
pipenv install flask_serverless
- 将
first_function/app.py
内容替换为:
fromflask_serverlessimportServerless,Flask,APIGWProxyapp=Flask(__name__)Serverless(app)lambda_handler=APIGWProxy(app)@app.route('/')defindex():return"Hello, friend!"
- 你准备好了!运行
make run
。读一下它弹出的自述文件。
更多…
很快就会有更多的文件。
进一步阅读
Serverless Flask applications on AWS lambda.