2012-03-02 18 views
1

私はdebian 6にuwsgi + python2.7 + django + nginxを使用しようとしています。 私はuwsgiコマンドをpip2.7 install uwsgiでインストールしましたので、python 2.7で動作しています。私はコマンドで天皇モードでuwsgiを実行している : uwsgi --emperorの/ etc/uwsgi /家臣/ -d /var/log/uwsgi.log --pidfile /var/run/uwsgi.piduwsgi + python2.7何もインポートできません

vassalsフォルダには、現在のところ1つのアプリしか含まれていません。ここでは、YAMLファイルだ次のとおりです。

uwsgi: 
    socket: /home/uwsgi/uwsgi/uwsgi.sock 
    virtualenv: /opt/myproj/virt 
    pythonpath: /home/uwsgi/project/my_proj 
    pidfile: /home/uwsgi/uwsgi/uwsgi.pid 
    uid: uwsgi 
    gid: uwsgi 
    chmod-socket: 1 
    module: wsgi_app 
    daemonize: /home/uwsgi/uwsgi/uwsgi.log 
    harakiri-verbose: 1 

これは、Djangoのプロジェクトファイルの内容です:

#! /usr/bin/python 
SITE_DIR = '/home/uwsgi/project/my_proj' 
import site 
site.addsitedir(SITE_DIR) 

import os 
import sys 
sys.path.append(SITE_DIR) 

sys.path.append('/home/uwsgi/project/') 
os.environ['DJANGO_SETTINGS_MODULE'] = 'my_proj.settings' 
import django.core.handlers.wsgi 
application = django.core.handlers.wsgi.WSGIHandler() 

さて、ここでの結果はとき/home/uwsgi/uwsgi/uwsgi.logファイルであります私はそれを起動しよう:

*** Starting uWSGI 1.0.4 (32bit) on [Fri Mar 2 19:00:46 2012] *** 
compiled with version: 4.6.2 on 02 March 2012 18:03:07 
current working directory: /etc/uwsgi/vassals 
writing pidfile to /home/uwsgi/uwsgi/uwsgi.pid 
detected binary path: /usr/local/bin/uwsgi 
setgid() to 1001 
setuid() to 1001 
your memory page size is 4096 bytes 
chmod() socket to 666 for lazy and brave users 
uwsgi socket 0 bound to UNIX address /home/uwsgi/uwsgi/uwsgi.sock fd 3 
Python version: 2.7.2+ (default, Dec 1 2011, 02:17:49) [GCC 4.6.2] 
Set PythonHome to /opt/myproj/virt 
ImportError: No module named site 
*** Starting uWSGI 1.0.4 (32bit) on [Fri Mar 2 19:00:47 2012] *** 
compiled with version: 4.6.2 on 02 March 2012 18:03:07 
current working directory: /etc/uwsgi/vassals 
writing pidfile to /home/uwsgi/uwsgi/uwsgi.pid 
detected binary path: /usr/local/bin/uwsgi 
setgid() to 1001 
setuid() to 1001 
your memory page size is 4096 bytes 
chmod() socket to 666 for lazy and brave users 
uwsgi socket 0 bound to UNIX address /home/uwsgi/uwsgi/uwsgi.sock fd 3 
Python version: 2.7.2+ (default, Dec 1 2011, 02:17:49) [GCC 4.6.2] 
Set PythonHome to /opt/myproj/virt 
ImportError: No module named site 

あなたが見ることができるようにuwsgiアプリを再起動しようとし続けるので、uwsgiは、サイトのモジュールをインポートすることはできません。 したがって、yamlファイルにno-site:1オプションを追加しようとしました。結果は私のDjangoプロジェクトファイルに何もインポートできないということです...

私は、プロジェクトにリンクしていないことも知っています。私は、Python 2.6でuwsgiを実行するとうまくいきます...残念ながら、私はPython2.7で実行する必要があります...

あなたは何が起こるか考えていますか?

ありがとうございます!

答えて

3

virtualenvがpython2.7用に構築されていることを確認してください。そうでない場合は使用できません。

それが今でデバッグだ/opt/myproj/virt/lib/python2.7ディレクトリ

+1

が含まれていなければなりません。 問題は、virtualenvのインストールに使用したスクリプトが無効になっていたことです。 pip-2.7ではなくpipでpythonツールをインストールしました。 – user1187797

+0

愚かな質問を申し訳ありませんが...どうすればチケットを閉じることができますか? – user1187797

+0

@ user1187797あなたはあなたが一番好きな答えを投票に投票します。 – dragon

関連する問題