我目前在AWS Lambda上使用Zappa/Flask(Py 3.7)的API
上我的 zappa_Settings.json 文件如下所示:
{
"beta": {
"app_function": "application.application",
"profile_name": "changed",
"project_name": "changed",
"runtime": "python3.7",
"s3_bucket": "zappa-<obscured>"
}
}
但是,我们现在正在研究一组新功能,并且感觉决定了我们有一个单独的分支或阶段,例如"测试",我们部署这些功能并在推送到实时环境之前评估成熟度。
问题是,尽我所能,我无法从控制台创建新阶段:
zappa init
崩溃与
click.exceptions.ClickException:此项目已经有一个 zappa_settings.json 文件!
zappa init stage2
生产
用法: 扎帕 [-h] [-v] [--颜色 {自动,从不,总是}] {认证,部署,初始化,包,模板,调用,管理,回滚,计划,状态,尾部,取消部署,取消计划,更新,外壳} ...扎帕:错误:无法识别的参数:阶段2
zappa deploy stage2
输出
(botocore 1.12.86 (/home/user/Code/Python/project/lib/python3.6/site-packages), Requirement.parse('botocore<1.11.0,>=1.10.82'), {'boto3'})
Calling deploy for stage stage2..
Error: Please define stage 'stage2' in your Zappa settings.
现在,如果我手动为阶段创建条目,则需要有一个用于部署的 s3 存储桶。重复使用第一个实例中的相同内容是否安全?我在这里做什么来部署新阶段?
zappa init
只是为了让您开始使用zappa_settings.json
文件,您不需要每次都运行它来编辑它。
例如。
{
"beta": {
"app_function": "application.application",
"profile_name": "changed",
"project_name": "changed",
"runtime": "python3.7",
"s3_bucket": "zappa-<obscured>"
},
"stage2": {
"app_function": "application.application",
"profile_name": "changed",
"project_name": "changed",
"runtime": "python3.7",
"s3_bucket": "zappa-<obscured>"
}
}
但是,这可以更好地写成。
{
"common": {
"app_function": "application.application",
"profile_name": "changed",
"project_name": "changed",
"runtime": "python3.7",
"s3_bucket": "zappa-<obscured>"
},
"beta": {
"extends": "common"
// additional overrides here
},
"stage2": {
"extends": "common"
// additional overrides here
}
}