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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM