uWSGI之ImportError: No module named uwsgi

安装完uwsgi1.9.11版本后,参考uwsgi文档说明

其中有段关于管理uWSGI服务的,其中有个例子是在python应用中使用 uwsgi 的API去管理(https://uwsgi-docs.readthedocs.org/en/latest/Management.html

其中的uwsgi.reload()

当在交互环境下执行import uwsgi时报错,提示没有 uwsgi 模块

开始以为前面安装uwsgi时缺少步骤导致模块没有生成,重新安装几次,依然如此。

这时就很纠结了,不知道哪里出了问题,只能求助于google了。

终于在网上找到问题(http://lists.unbit.it/pipermail/uwsgi/2011-February/001434.html

uWSGI is not a python module, it is a binary server.
After the istallation you will find it in the /bin of your virtualenv
The app run by uWSGI can access the "uwsgi" module that export specific api functions.

 

意思是当使用uwsgi服务运行时,会把uwsgi作为内建(built-in)模块加载进去。

可以在python应用中是使用 print uwsgi 验证

输出如下:

(<module 'uwsgi' (built-in)>)

 关于python中uwsgi模块的一些API,请参考(https://uwsgi-docs.readthedocs.org/en/latest/PythonModule.html?highlight=import%20uwsgi

posted @ 2013-06-03 14:59  布雷泽  阅读(5304)  评论(0编辑  收藏  举报