我在将无服务器应用程序部署到 AWS 时遇到问题。在 AWS 中,日志显示:
Unable to import module 'wsgi_handler': No module named 'werkzeug'
Run Code Online (Sandbox Code Playgroud)
我已经在我的 requirements.txt 中明确指定了 werkzeug,但是当我运行时sls deploy,指定的包似乎没有放在上传到我的 S3 存储桶的 zip 文件中。
下面是我的 serverless.yml 文件的副本:
service: serverless-flask
plugins:
- serverless-python-requirements
- serverless-wsgi
- serverless-dynamodb-local
custom:
tableName: 'transactions-table-${self:provider.stage}'
wsgi:
app: app.app # entrypoint is app.app, which means the app object in the app.py module.
packRequirements: false
pythonRequirements:
dockerizePip: true
dynamodb:
stages:
- test
- dev
start:
migrate: true
provider:
name: aws
runtime: python3.6
stage: dev
region: us-east-1
iamRoleStatements: …Run Code Online (Sandbox Code Playgroud)