我有一个AWS EC2实例通过apache运行烧瓶应用程序。
我已经通过pip安装了boto
我已经设置了一个wsgi文件,如果我的烧瓶应用程序是一个简单的hello世界,它可以正常工作:
#This works
from flask import Flask
app = Flask(__name__)
@app.route("/hello")
def hello():
return "Hello World"
if __name__ == "__main__":
app.run(host='0.0.0.0',port=80)
#http://<PUBLIC_IP>.ap-southeast-2.compute.amazonaws.com/hello
#Hello World
但如果我尝试导入boto:
from boto import dynamodb2
from boto.dynamodb2.table import Table
当我访问http://.ap-southeast-2.compute.amazonaws.com/hello时 我收到内部服务器错误。检查日志显示了这个
[Thu Aug 06 03:20:50 2015] [error] [client 203.220.19.142] mod_wsgi (pid=2988): Target WSGI script '/var/www/myservice/myservice.wsgi' cannot be loaded as Python module.
[Thu Aug 06 03:20:50 2015] [error] [client 203.220.19.142] mod_wsgi (pid=2988): Exception occurred processing WSGI script '/var/www/myservice/myservice.wsgi'.
[Thu Aug 06 03:20:50 2015] [error] [client 203.220.19.142] Traceback (most recent call last):
[Thu Aug 06 03:20:50 2015] [error] [client 203.220.19.142] File "/var/www/myservice/myservice.wsgi", line 4, in <module>
[Thu Aug 06 03:20:50 2015] [error] [client 203.220.19.142] from myservice import app as application
[Thu Aug 06 03:20:50 2015] [error] [client 203.220.19.142] File "/var/www/myservice/myservice.py", line 6, in <module>
[Thu Aug 06 03:20:50 2015] [error] [client 203.220.19.142] from boto import dynamodb2
[Thu Aug 06 03:20:50 2015] [error] [client 203.220.19.142] ImportError: No module named boto
即使我已经安装了boto(pip install boto
)
我该如何解决这个问题?
答案 0 :(得分:0)
我搜索了yum的相关内容并运行:
yum install python26-boto.noarch
我修正了问题