3

uWSGIが起動すると、書き込みます

"ImportError: No module named wsgi"

私の 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>

サーバーはブラウザに応答します:

"uWSGI Error

Python application not found"

そして置く

"[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)"

そのログファイルにあります。

「ImportError:wsgiという名前のモジュールはありません」と書かれているので、uWSGI用のwsgiモジュールをインストールする必要があると思います。このモジュールがインストールされているかどうかを確認するにはどうすればよいですか?

4

1 に答える 1

1

を指定<module>wsgi</module>したので、uWSGI は、指定されたモジュールをロードしてそれwsgiを提供するために、あなたが要求したことを実行します。Python スクリプトはどのようにインストールされていますか? 提供するPythonプログラムがあることさえ言及していません。

おそらく、本当に必要なのは、<file>ディレクティブを使用して uWSGI に Python ファイルを読み取るパスを伝え、それを提供することです。wsgiインストール済みのモジュールを使用している場合は、提供しようとしている適切なモジュールで<module>タグを置き換える必要があります。

于 2012-03-25T22:00:53.767 に答える