2013-04-28 61 views
12

我用make編譯了uwsgi並且成功完成了,現在我決定用python3.3來運行我的django1.5站點。我檢查了DOC(http://projects.unbit.it/uwsgi/wiki/Guide4Packagers),並通過建立python3.3開發頭apt-get和再由編譯插件:uwsgi python3插件不起作用

python3.3 uwsgiconfig.py --plugin插件/ Python包python33

然後它說:

using profile: buildconf/package.ini 
detected include path: ['/usr/lib/gcc/i686-linux-gnu/4.7/include', '/usr/local/include','/usr/lib/gcc/i686-linux-gnu/4.7/include-fixed', '/usr/include/i386-linux-gnu', '/usr/include'] 
*** uWSGI building and linking plugin plugins/python *** 
[i686-linux-gnu-gcc -pthread] /usr/lib/uwsgi/python33_plugin.so 
*** python33 plugin built and available in /usr/lib/uwsgi/python33_plugin.so *** 

似乎一切都做得很好,我確實發現在該目錄python33_plugin.so。 nginx的運行並處於正常狀態,現在我的uwsgi ini文件是這樣的:

[uwsgi] 
socket=0.0.0.0:8000 
listen=20 
master=true 
pidfile=/usr/local/nginx/uwsgi.pid 
processes=2 
plugins=python33 
module=django_wsgi 
pythonpath= 
profiler=true 
memory-report=true 
enable-threads=true 
logdate=true 
limit-as=6048 

,當我運行 「命令./uwsgi uwsgi.ini」,

[uWSGI] getting INI configuration from uwsgi.ini 
open("./python33_plugin.so"): No such file or directory [core/utils.c line 3347] 
!!! UNABLE to load uWSGI plugin: ./python33_plugin.so: cannot open shared object file: No such file or directory !!! 

未找到中的.so file.anyway然後我複製.so文件到uwsgi目錄,然後再次運行,

[uWSGI] getting INI configuration from uwsgi.ini 
Sun Apr 28 22:54:40 2013 - *** Starting uWSGI 1.9.8 (32bit) on [Sun Apr 28 22:54:40 2013] *** 
Sun Apr 28 22:54:40 2013 - compiled with version: 4.7.3 on 28 April 2013 21:25:27 
Sun Apr 28 22:54:40 2013 - os: Linux-3.8.0-19-generiC#29-Ubuntu SMP Wed Apr 17 18:19:42 UTC 2013 
Sun Apr 28 22:54:40 2013 - nodename: bill-Rev-1-0 
Sun Apr 28 22:54:40 2013 - machine: i686 
Sun Apr 28 22:54:40 2013 - clock source: unix 
Sun Apr 28 22:54:40 2013 - pcre jit disabled 
Sun Apr 28 22:54:40 2013 - detected number of CPU cores: 4 
Sun Apr 28 22:54:40 2013 - current working directory: /media/bill/cloud/cloud/program/kkblog/kkblog 
Sun Apr 28 22:54:40 2013 - writing pidfile to /usr/local/nginx/uwsgi.pid 
Sun Apr 28 22:54:40 2013 - detected binary path: /usr/sbin/uwsgi 
Sun Apr 28 22:54:40 2013 - uWSGI running as root, you can use --uid/--gid/--chroot options 
Sun Apr 28 22:54:40 2013 - *** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
Sun Apr 28 22:54:40 2013 - your processes number limit is 31552 
Sun Apr 28 22:54:40 2013 - limiting address space of processes... 
Sun Apr 28 22:54:40 2013 - your process address space limit is 2046820352 bytes (1952 MB) 
Sun Apr 28 22:54:40 2013 - your memory page size is 4096 bytes 
Sun Apr 28 22:54:40 2013 - detected max file descriptor number: 1024 
Sun Apr 28 22:54:40 2013 - lock engine: pthread robust mutexes 
Sun Apr 28 22:54:40 2013 - uwsgi socket 0 bound to TCP address 0.0.0.0:8000 fd 3 
Sun Apr 28 22:54:40 2013 - Python version: 2.7.4 (default, Apr 19 2013, 18:35:44) [GCC 4.7.3] 
Sun Apr 28 22:54:40 2013 - Python main interpreter initialized at 0x973e2d0 
Sun Apr 28 22:54:40 2013 - python threads support enabled 

我使用的Ubuntu 13.04和python2.7和python3.3預裝。

我設置了PYTHON33插件但是UWSGI仍然啓動了PYTHON2.7,爲什麼?

有誰遇到過這個問題?順便說一下,我不喜歡通過apt-get來設置uwsgi和插件,因爲它不適用於任何PaaS。

謝謝!

回答

11

您已經構建了一個嵌入python 2.7的單片uWSGI二進制文件,因此插件無法覆蓋該內存區域。您可以通過構建一個簡單的單片python3二進制:

python3 uwsgiconfig.py --build 

或使用PIP爲python3

否則,您可以建立一個完全模塊化的系統:

python uwsgiconfig.py --build core 
python uwsgiconfig.py --plugin plugins/python core python27 
python3 uwsgiconfig.py --plugin plugins/python core python33