uWSGI用于使用django运行Python 2和Python 3

uWSGI用于使用django运行Python 2和Python 3,python,django,uwsgi,Python,Django,Uwsgi,我已经在全球范围内安装了uWSGI,它使用Python3.3的virtualenv和Django运行得很好。但现在我想尝试使用Python2.7运行另一个uWSGI实例。我在Python2.7的virtualenv中为home设置了选项,但它使用的Python版本仍然是3.3版本 目前我对uWSGI有以下设置: # Django-related settings # the base directory (full path) chdir = /home/srvadmi

我已经在全球范围内安装了uWSGI,它使用Python3.3的virtualenv和Django运行得很好。但现在我想尝试使用Python2.7运行另一个uWSGI实例。我在Python2.7的virtualenv中为home设置了选项,但它使用的Python版本仍然是3.3版本

目前我对uWSGI有以下设置:

 # Django-related settings
 # the base directory (full path)
 chdir           = /home/srvadmin/webapps2.7/project
 # Django's wsgi file
 module          = project.wsgi
 # the virtualenv (full path)
 home            = /home/srvadmin/py2.7

 # process-related settings
 # master
 master          = true
 # maximum number of worker processes
 processes       = 10
 # the socket (use the full path to be safe
 socket          = /tmp/mysite2.7.sock
 # ... with appropriate permissions - may be needed
 chmod-socket    = 666
 # clear environment on exit
 vacuum          = true
但我一直都明白这一点

uWSGI http bound on 0.0.0.0:1234 fd 4
spawned uWSGI http 1 (pid: 31507)
uwsgi socket 0 bound to TCP address 127.0.0.1:33896 (port auto-assigned) fd 3
Python version: 3.3.2 (default, May 16 2013, 18:35:00)  [GCC 4.6.3]
Set PythonHome to /home/srvadmin/py2.7/
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named 'encodings'
Aborted

您的uWSGI二进制文件与特定的libpython(3.3版本)链接。您必须为python2.7构建第二个uWSGI副本或使用模块化构建:

(来自源目录)

python3 uwsgiconfig.py——构建nolang

python3-uwsgiconfig.py——插件插件/python-nolang-python33

python2 uwsgiconfig.py——插件插件/pythonnolang python27


您将以一个'uwsgi'二进制文件和'python33_plugin.so'和'python27_plugin.so'结束。

所以我必须从源代码编译它?这不会影响系统范围的uwsgi,对吗?谢谢你的回答。:)不,生成的二进制文件和插件将构建在源目录中