uWSGI says: “ImportError: No module named wsgi”

不问归期 提交于 2019-12-13 14:15:20

问题


When uWSGI starts, it writes

"ImportError: No module named wsgi"

My uwsgi.xml

<!-- UWSGI XML Configuration File -->
<uwsgi>
    <uid>quux</uid>
    <gid>quux</gid>

    <chdir>/var/www</chdir>
    <!-- <socket>/var/www/uwsgi.sock</socket> -->
    <socket>127.0.0.1:8012</socket>

    <!-- <home>/home/klen/Projects/klen.github.com/_code/uwsgi/.virtualenv</home> -->

    <plugins>python</plugins>
    <pythonpath>/var/www/</pythonpath>
    <module>wsgi</module>
    <env>/usr/bin/python</env>

    <processes>2</processes>
    <max-requests>5000</max-requests>
    <buffer-size>32768</buffer-size>
    <harakiri>30</harakiri>
    <reload-mercy>8</reload-mercy>
    <master />
    <no-orphans />

</uwsgi>

Server replies to browser:

"uWSGI Error

Python application not found"

and puts

"[pid: 7529|app: -1|req: -1/1] 178.132.203.33 () {46 vars in 797 bytes} [Mon Mar 26 00:56:53 2012] GET /index.py => generated 48 bytes in 0 msecs (HTTP/1.0 500) 2 headers in 63 bytes (0 switches on core 0)"

in it's log file.

I think I need to install wsgi module for uWSGI as it writes "ImportError: No module named wsgi". How can I check if this module is installed?


回答1:


You have specified <module>wsgi</module>, and so uWSGI is doing what you have asked of it, to load a module named wsgi and serve it. How is your python script installed? You haven't even mentioned that you have a python program to serve.

Probably, what you really want is to use the <file> directive to tell uWSGI the path to read a python file from, and serve that. If you are using an installed module, you should substitute wsgi in the <module> tag with the appropriate module you are trying to serve.



来源:https://stackoverflow.com/questions/9864044/uwsgi-says-importerror-no-module-named-wsgi

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!