2014-02-11 74 views
3

我使用nginx + django + uwsgi來部署我的應用程序,但是我發現它在我的主機上不起作用。錯誤是這樣的:uWSGI重置PythonHome

[uWSGI] parsing config file forum/uwsgi.xml 
*** Starting uWSGI 2.0.1 (64bit) on [Tue Feb 11 10:42:47 2014] *** 
compiled with version: 4.7.3 on 11 February 2014 09:35:41 
os: Linux-2.6.35-32-server #64 SMP Fri Jan 13 06:36:08 CST 2012 
nodename: AY120826095xxxx 
machine: x86_64 
clock source: unix 
pcre jit disabled 
detected number of CPU cores: 1 
current working directory: /home/foo/git/project 
detected binary path: /home/foo/git/software/uwsgi-2.0.1/uwsgi 
*** WARNING: you are running uWSGI without its master process manager *** 
your memory page size is 4096 bytes 
detected max file descriptor number: 1024 
lock engine: pthread robust mutexes 
thunder lock: disabled (you can enable it with --thunder-lock) 
uwsgi socket 0 bound to TCP address 127.0.0.1:8630 fd 3 
Python version: 2.7.4 (default, Sep 26 2013, 03:23:21) [GCC 4.7.3] 
Set PythonHome to /home/foo/software/uwsgi-2.0.1 
ImportError: No module named site 

我把它部署在我的本地計算機,它的工作原理。我該如何解決這個問題?

的配置文件如下:

<uwsgi> 
    <socket>127.0.0.1:8630</socket> 
    <chdir>/home/foo/git/project/forum</chdir> 
    <module>wsgi</module> 
</uwsgi> 

和我的本地計算機上的控制檯輸出爲:

[uWSGI] parsing config file forum/uwsgi.xml 
*** Starting uWSGI 2.0.1 (64bit) on [Tue Feb 11 14:24:59 2014] *** 
compiled with version: 4.7.3 on 11 February 2014 07:24:13 
os: Linux-3.8.0-19-generiC#29-Ubuntu SMP Wed Apr 17 18:16:28 UTC 2013 
nodename: alienware 
machine: x86_64 
clock source: unix 
pcre jit disabled 
detected number of CPU cores: 8 
current working directory: /home/foo/project/osqa 
detected binary path: /home/foo/uwsgi-2.0.1/uwsgi 
*** WARNING: you are running uWSGI without its master process manager *** 
your processes number limit is 62679 
your memory page size is 4096 bytes 
detected max file descriptor number: 1024 
lock engine: pthread robust mutexes 
thunder lock: disabled (you can enable it with --thunder-lock) 
uwsgi socket 0 bound to TCP address 127.0.0.1:8630 fd 6 
Python version: 2.7.4 (default, Sep 26 2013, 03:23:21) [GCC 4.7.3] 
Python main interpreter initialized at 0x23a6100 
python threads support enabled 
your server socket listen backlog is limited to 100 connections 
your mercy for graceful operations on workers is 60 seconds 
mapped 72760 bytes (71 KB) for 1 cores 
*** Operational MODE: single process *** 
WSGI app 0 (mountpoint='') ready in 0 seconds on interpreter 0x23a6100 pid: 21702 (default app) 
*** uWSGI is running in multiple interpreter mode *** 
spawned uWSGI worker 1 (and the only) (pid: 21702, cores: 1) 
+0

是什麼'論壇/ uwsgi.xml'是什麼樣子? – cpburnz

+0

是的,你的配置文件是什麼樣子的,或者你是如何從命令行調用uwsgi的? – reptilicus

+0

本地計算機上使用相同配置的輸出是什麼? – cpburnz

回答

1

如果你使用VIRTUALENV 沒有,則必須添加pythonpath指令到您的配置文件:

pythonpath = /usr/local/lib/python2.7/dist-packages 
pythonpath = /usr/lib/python2.7 

這是.ini語法,請將其調整爲您的XML配置。

+0

我已經修改了配置文件,如下所示: 127.0.0.1:8630 /家庭/富/的git /項目/論壇 /usr/lib/python2.7 WSGI 但它仍然不起作用 – uuball

+0

@uuball它是否會給出相同的錯誤?爲什麼只有一條路?我使用我發佈在Ubuntu上的兩個包含所有安裝在python中的軟件包。 –

0

添加到ini文件這樣的: plugins = python