【发布时间】:2016-01-16 09:17:10
【问题描述】:
我在 AWS Beanstalk 上收到以下错误:
Traceback (most recent call last):
File "/opt/python/current/app/silverwebapp/application.py", line 4, in <module>
from forms import CommentForm
ImportError: No module named forms
当我在本地运行它时,一切正常。我不知道为什么这里不存在“表格”。
这是我的文件夹结构:
SilverWeb/
├── README.md
├── requirements.txt
└── silverwebapp
├── application.py
├── application.pyc
├── config.py
├── config.pyc
├── db_create.py
├── forms.py
├── forms.pyc
├── static
│ ├── startbootstrap-grayscale
│ └── static
└── templates
├── hello.html
└── submit.html
这是我的 .ebextensions/static.config:
option_settings:
- namespace: aws:elasticbeanstalk:container:python:staticfiles
option_name: /static/
value: silverwebapp/static/
- namespace: aws:elasticbeanstalk:container:python
option_name: StaticFiles
value: /static/=silverapp/static/
option_name: WSGIPath
value: silverwebapp/application.py
我可以确认,当我通过eb ssh SSH 进入我的弹性 bean 实例时,文件“forms.py”确实存在。
为什么我会收到此错误,即不存在名为 forms 的模块?显然,forms.py 存在于包含 application.py 的文件夹中
【问题讨论】:
标签: python amazon-web-services flask amazon-elastic-beanstalk