通过CodeCommit使用AWS Elastic Beanstalk部署flask应用程序时导入flask和mod_wsgi错误

时间:2017-07-10 15:34:28

标签: python amazon-web-services amazon-ec2 flask mod-wsgi

我正在尝试使用名为application.py的弹性beanstalk部署Flask应用程序:

from flask import Flask

application = Flask(__name__)

@application.route('/')
def index():
return "It works!"

if __name__ == '__main__':
application.run(debug=True)

我在site-packages中有Flask个包,我使用的是python3.4。

使用的平台版本是:  arn:aws:elasticbeanstalk:us-east-1::platform/Python 3.4 running on 64bit Amazon Linux/2.4.1

以下是错误日志:

[Mon Jul 10 14:27:47.022722 2017] [:error] [pid 11504] [remote 
172.31.70.190:32541]   File "/opt/python/current/app/application.py", line 1, 
in <module>
[Mon Jul 10 14:27:47.022727 2017] [:error] [pid 11504] [remote 
172.31.70.190:32541]     from flask import Flask
[Mon Jul 10 14:27:47.022748 2017] [:error] [pid 11504] [remote 
172.31.70.190:32541] ImportError: No module named 'flask'
[Mon Jul 10 14:28:01.240877 2017] [:error] [pid 11504] [remote 
172.31.46.142:32541] mod_wsgi (pid=11504): Target WSGI script 
'/opt/python/current/app/application.py' cannot be loaded as Python module.
[Mon Jul 10 14:28:01.240931 2017] [:error] [pid 11504] [remote 
172.31.46.142:32541] mod_wsgi (pid=11504): Exception occurred processing WSGI 
script '/opt/python/current/app/application.py'.

0 个答案:

没有答案