2

I have uWSGI installed globally and it's running with a virtualenv of Python 3.3 with Django just fine. But now I want to try running another instance of uWSGI using Python 2.7. I set the option for home in the virtualenv of Python 2.7 but the python version it's using is still 3.3 version.

Currently I have this settings for 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

But I always get this

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
4

1 に答える 1

3

あなたの uWSGI バイナリは、特定の libpython (3.3 のもの) にリンクされています。python2.7 用の uWSGI の 2 つ目のコピーをビルドするか、モジュラー ビルドを使用する必要があります。

(ソースディレクトリから)

python3 uwsgiconfig.py --build nolang

python3 uwsgiconfig.py --plugin plugins/python nolang python33

python2 uwsgiconfig.py --plugin plugins/python nolang python27

「uwsgi」バイナリと「python33_plugin.so」および「python27_plugin.so」で終了します

于 2013-08-27T05:47:56.233 に答える