我正在开发一个 openstack Horizon 插件,它应该通过 ReST API 轮询一些信息。我正在关注本教程: http ://docs.openstack.org/developer/horizon/topics/tutorial.html
所以在文件 /opt/stack/horizon/openstack_dashboard/dashboards/mydashboard/mypanel/views.py 我有:
from horizon import tabs
from horizon import views
from openstack_dashboard.dashboards.mydashboard.mypanel import tabs as mydashboard_tabs
import sys
import pycurl
导致ImportError: No module named pycurl
如果我加载 python 并检查,pycurl 是可加载的:
oink@ubuntu14-devstack:/opt/stack/horizon/openstack_dashboard/dashboards/mydashboard/templates/mydashboard/mypanel$ python
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pycurl
>>> pycurl
<module 'pycurl' from '/usr/lib/python2.7/dist-packages/pycurl.so'>
OpenStack 正在运行 python 版本2.7.6 (default, Mar 22 2014, 22:59:56) [GCC 4.8.2]
,它与我的行解释器匹配。如何在 OpenStack Horizon 视图中使用 pycurl?(或者,从 Horizon 轮询 ReST API 的好机制是什么?)